summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenis Vlasenko2006-10-26 23:25:17 +0000
committerDenis Vlasenko2006-10-26 23:25:17 +0000
commitddec5af6b0803c7434a1cc2fdee5cb9873fe6bd0 (patch)
treef4f2aa58fa669aed6e2c50bb7aa648a79ec1873d /coreutils
parentf0ed376eda5d5c25d270e5100a881fb2d801bee6 (diff)
downloadbusybox-ddec5af6b0803c7434a1cc2fdee5cb9873fe6bd0.zip
busybox-ddec5af6b0803c7434a1cc2fdee5cb9873fe6bd0.tar.gz
rename functions to more understandable names
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/cat.c4
-rw-r--r--coreutils/cksum.c2
-rw-r--r--coreutils/cmp.c5
-rw-r--r--coreutils/cut.c2
-rw-r--r--coreutils/fold.c4
-rw-r--r--coreutils/head.c4
-rw-r--r--coreutils/md5_sha1_sum.c2
-rw-r--r--coreutils/sum.c6
-rw-r--r--coreutils/tee.c2
-rw-r--r--coreutils/uudecode.c2
-rw-r--r--coreutils/wc.c4
11 files changed, 18 insertions, 19 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 10eb29c..a959805 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -26,10 +26,10 @@ int cat_main(int argc, char **argv)
}
do {
- f = bb_wfopen_input(*argv);
+ f = fopen_or_warn_stdin(*argv);
if (f) {
off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO);
- bb_fclose_nonstdin(f);
+ fclose_if_not_stdin(f);
if (r >= 0) {
continue;
}
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index 3a9b0b0..5221332 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -22,7 +22,7 @@ int cksum_main(int argc, char **argv)
int inp_stdin = (argc == optind) ? 1 : 0;
do {
- fp = bb_wfopen_input((inp_stdin) ? bb_msg_standard_input : *++argv);
+ fp = fopen_or_warn_stdin((inp_stdin) ? bb_msg_standard_input : *++argv);
crc = 0;
length = 0;
diff --git a/coreutils/cmp.c b/coreutils/cmp.c
index 2b923c8..71007ea 100644
--- a/coreutils/cmp.c
+++ b/coreutils/cmp.c
@@ -27,10 +27,9 @@ static FILE *cmp_xfopen_input(const char * const filename)
{
FILE *fp;
- if ((fp = bb_wfopen_input(filename)) != NULL) {
+ fp = fopen_or_warn_stdin(filename);
+ if (fp)
return fp;
- }
-
exit(xfunc_error_retval); /* We already output an error message. */
}
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 5dc3543..a538e3d 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -272,7 +272,7 @@ int cut_main(int argc, char **argv)
FILE *file;
for (; optind < argc; optind++) {
- file = bb_wfopen(argv[optind], "r");
+ file = fopen_or_warn(argv[optind], "r");
if (file) {
cut_file(file);
fclose(file);
diff --git a/coreutils/fold.c b/coreutils/fold.c
index e33be55..9ca693d 100644
--- a/coreutils/fold.c
+++ b/coreutils/fold.c
@@ -70,7 +70,7 @@ int fold_main(int argc, char **argv)
}
do {
- FILE *istream = bb_wfopen_input(*argv);
+ FILE *istream = fopen_or_warn_stdin(*argv);
int c;
int column = 0; /* Screen column where next char will go. */
int offset_out = 0; /* Index in `line_out' for next char. */
@@ -144,7 +144,7 @@ rescan:
fwrite(line_out, sizeof(char), (size_t) offset_out, stdout);
}
- if (ferror(istream) || bb_fclose_nonstdin(istream)) {
+ if (ferror(istream) || fclose_if_not_stdin(istream)) {
bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */
errs |= EXIT_FAILURE;
}
diff --git a/coreutils/head.c b/coreutils/head.c
index 2e9000d..d732461 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -112,7 +112,7 @@ int head_main(int argc, char **argv)
#endif
do {
- fp = bb_wfopen_input(*argv);
+ fp = fopen_or_warn_stdin(*argv);
if (fp) {
if (fp == stdin) {
*argv = (char *) bb_msg_standard_input;
@@ -127,7 +127,7 @@ int head_main(int argc, char **argv)
}
putchar(c);
}
- if (bb_fclose_nonstdin(fp)) {
+ if (fclose_if_not_stdin(fp)) {
bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */
retval = EXIT_FAILURE;
}
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index ca23d8a..93d8946 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)
bb_error_msg("WARNING: %d of %d computed checksums did NOT match",
count_failed, count_total);
}
- if (bb_fclose_nonstdin(pre_computed_stream) == EOF) {
+ if (fclose_if_not_stdin(pre_computed_stream) == EOF) {
bb_perror_msg_and_die("cannot close file %s", file_ptr);
}
} else {
diff --git a/coreutils/sum.c b/coreutils/sum.c
index d663e34..93f4e22 100644
--- a/coreutils/sum.c
+++ b/coreutils/sum.c
@@ -38,7 +38,7 @@ static int bsd_sum_file(const char *file, int print_name)
fp = stdin;
have_read_stdin++;
} else {
- fp = bb_wfopen(file, "r");
+ fp = fopen_or_warn(file, "r");
if (fp == NULL)
goto out;
}
@@ -52,11 +52,11 @@ static int bsd_sum_file(const char *file, int print_name)
if (ferror(fp)) {
bb_perror_msg(file);
- bb_fclose_nonstdin(fp);
+ fclose_if_not_stdin(fp);
goto out;
}
- if (bb_fclose_nonstdin(fp) == EOF) {
+ if (fclose_if_not_stdin(fp) == EOF) {
bb_perror_msg(file);
goto out;
}
diff --git a/coreutils/tee.c b/coreutils/tee.c
index f0e1fad..06c94ab 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -49,7 +49,7 @@ int tee_main(int argc, char **argv)
goto GOT_NEW_FILE;
do {
- if ((*p = bb_wfopen(*argv, mode)) == NULL) {
+ if ((*p = fopen_or_warn(*argv, mode)) == NULL) {
retval = EXIT_FAILURE;
continue;
}
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index c8152a8..a08d985 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -174,7 +174,7 @@ int uudecode_main(int argc, char **argv)
}
free(line);
ret = decode_fn_ptr(src_stream, dst_stream);
- bb_fclose_nonstdin(src_stream);
+ fclose_if_not_stdin(src_stream);
return(ret);
}
bb_error_msg_and_die("No `begin' line");
diff --git a/coreutils/wc.c b/coreutils/wc.c
index ebae5f6..4b76e54 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -107,7 +107,7 @@ int wc_main(int argc, char **argv)
while ((arg = *argv++) != 0) {
++num_files;
- fp = bb_wfopen_input(arg);
+ fp = fopen_or_warn_stdin(arg);
if (!fp) {
status = EXIT_FAILURE;
continue;
@@ -172,7 +172,7 @@ int wc_main(int argc, char **argv)
}
totals[WC_LENGTH] -= counts[WC_LENGTH];
- bb_fclose_nonstdin(fp);
+ fclose_if_not_stdin(fp);
OUTPUT:
/* coreutils wc tries hard to print pretty columns