aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-26 23:21:47 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-26 23:21:47 +0000
commitf0ed376eda5d5c25d270e5100a881fb2d801bee6 (patch)
tree79166b700c497fbe798b6031e5bbff97e0933573 /coreutils
parent670a6626cabc1498f32b35f959591f8621d8447e (diff)
downloadbusybox-f0ed376eda5d5c25d270e5100a881fb2d801bee6.tar.gz
remove bb_printf and the like
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/basename.c2
-rw-r--r--coreutils/cal.c10
-rw-r--r--coreutils/catv.c8
-rw-r--r--coreutils/cksum.c6
-rw-r--r--coreutils/cmp.c10
-rw-r--r--coreutils/dd.c2
-rw-r--r--coreutils/df.c51
-rw-r--r--coreutils/dirname.c2
-rw-r--r--coreutils/du.c6
-rw-r--r--coreutils/echo.c2
-rw-r--r--coreutils/env.c2
-rw-r--r--coreutils/expr.c4
-rw-r--r--coreutils/fold.c2
-rw-r--r--coreutils/head.c9
-rw-r--r--coreutils/hostid.c4
-rw-r--r--coreutils/id.c18
-rw-r--r--coreutils/logname.c2
-rw-r--r--coreutils/nice.c4
-rw-r--r--coreutils/printenv.c2
-rw-r--r--coreutils/pwd.c2
-rw-r--r--coreutils/realpath.c2
-rw-r--r--coreutils/sort.c2
-rw-r--r--coreutils/tee.c6
-rw-r--r--coreutils/tty.c2
-rw-r--r--coreutils/uname.c6
-rw-r--r--coreutils/uniq.c14
-rw-r--r--coreutils/uuencode.c10
-rw-r--r--coreutils/wc.c6
-rw-r--r--coreutils/whoami.c2
-rw-r--r--coreutils/yes.c4
30 files changed, 103 insertions, 99 deletions
diff --git a/coreutils/basename.c b/coreutils/basename.c
index 446f486cd..30f76dc12 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -46,5 +46,5 @@ int basename_main(int argc, char **argv)
puts(s);
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/coreutils/cal.c b/coreutils/cal.c
index e2bc5ab12..6f5f0a434 100644
--- a/coreutils/cal.c
+++ b/coreutils/cal.c
@@ -139,7 +139,7 @@ int cal_main(int argc, char **argv)
day_array(month, year, dp);
len = sprintf(lineout, "%s %d", month_names[month - 1], year);
- bb_printf("%*s%s\n%s\n",
+ printf("%*s%s\n%s\n",
((7*julian + WEEK_LEN) - len) / 2, "",
lineout, day_headings);
for (row = 0; row < 6; row++) {
@@ -170,9 +170,9 @@ int cal_main(int argc, char **argv)
center(month_names[month + 1], week_len, HEAD_SEP);
}
center(month_names[month + 2 - julian], week_len, 0);
- bb_printf("\n%s%*s%s", day_headings, HEAD_SEP, "", day_headings);
+ printf("\n%s%*s%s", day_headings, HEAD_SEP, "", day_headings);
if (!julian) {
- bb_printf("%*s%s", HEAD_SEP, "", day_headings);
+ printf("%*s%s", HEAD_SEP, "", day_headings);
}
putchar('\n');
for (row = 0; row < (6*7); row += 7) {
@@ -186,7 +186,7 @@ int cal_main(int argc, char **argv)
}
}
- bb_fflush_stdout_and_exit(0);
+ fflush_stdout_and_exit(0);
}
/*
@@ -281,7 +281,7 @@ static void center(char *str, int len, int separate)
{
int n = strlen(str);
len -= n;
- bb_printf("%*s%*s", (len/2) + n, str, (len/2) + (len % 2) + separate, "");
+ printf("%*s%*s", (len/2) + n, str, (len/2) + (len % 2) + separate, "");
}
static void blank_string(char *buf, size_t buflen)
diff --git a/coreutils/catv.c b/coreutils/catv.c
index a5a8b43e4..66f30693a 100644
--- a/coreutils/catv.c
+++ b/coreutils/catv.c
@@ -42,10 +42,10 @@ int catv_main(int argc, char **argv)
if (c > 126 && (flags & CATV_OPT_v)) {
if (c == 127) {
- bb_printf("^?");
+ printf("^?");
continue;
} else {
- bb_printf("M-");
+ printf("M-");
c -= 128;
}
}
@@ -54,7 +54,7 @@ int catv_main(int argc, char **argv)
if (flags & CATV_OPT_e)
putchar('$');
} else if (flags & (c==9 ? CATV_OPT_t : CATV_OPT_v)) {
- bb_printf("^%c", c+'@');
+ printf("^%c", c+'@');
continue;
}
}
@@ -65,5 +65,5 @@ int catv_main(int argc, char **argv)
close(fd);
} while (*++argv);
- return retval;
+ fflush_stdout_and_exit(retval);
}
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index 9bec3bff4..3a9b0b08c 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -41,13 +41,13 @@ int cksum_main(int argc, char **argv)
crc ^= 0xffffffffL;
if (inp_stdin) {
- bb_printf("%" PRIu32 " %li\n", crc, filesize);
+ printf("%" PRIu32 " %li\n", crc, filesize);
break;
}
- bb_printf("%" PRIu32 " %li %s\n", crc, filesize, *argv);
+ printf("%" PRIu32 " %li %s\n", crc, filesize, *argv);
fclose(fp);
} while (*(argv + 1));
- return EXIT_SUCCESS;
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/coreutils/cmp.c b/coreutils/cmp.c
index 07858c64e..2b923c845 100644
--- a/coreutils/cmp.c
+++ b/coreutils/cmp.c
@@ -96,7 +96,7 @@ int cmp_main(int argc, char **argv)
c1 = c2;
}
if (c1 == EOF) {
- xferror(fp1, filename1);
+ die_if_ferror(fp1, filename1);
fmt = fmt_eof; /* Well, no error, so it must really be EOF. */
outfile = stderr;
/* There may have been output to stdout (option -l), so
@@ -107,7 +107,7 @@ int cmp_main(int argc, char **argv)
if (opt & CMP_OPT_l) {
line_pos = c1; /* line_pos is unused in the -l case. */
}
- bb_fprintf(outfile, fmt, filename1, filename2, char_pos, line_pos, c2);
+ fprintf(outfile, fmt, filename1, filename2, char_pos, line_pos, c2);
if (opt) { /* This must be -l since not -s. */
/* If we encountered an EOF,
* the while check will catch it. */
@@ -121,8 +121,8 @@ int cmp_main(int argc, char **argv)
}
} while (c1 != EOF);
- xferror(fp1, filename1);
- xferror(fp2, filename2);
+ die_if_ferror(fp1, filename1);
+ die_if_ferror(fp2, filename2);
- bb_fflush_stdout_and_exit(retval);
+ fflush_stdout_and_exit(retval);
}
diff --git a/coreutils/dd.c b/coreutils/dd.c
index d60192e7c..d72ca8b7e 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -29,7 +29,7 @@ static off_t out_full, out_part, in_full, in_part;
static void dd_output_status(int ATTRIBUTE_UNUSED cur_signal)
{
- bb_fprintf(stderr, OFF_FMT"+"OFF_FMT" records in\n"
+ fprintf(stderr, OFF_FMT"+"OFF_FMT" records in\n"
OFF_FMT"+"OFF_FMT" records out\n",
in_full, in_part,
out_full, out_part);
diff --git a/coreutils/df.c b/coreutils/df.c
index 94ead32eb..c569dae33 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -51,25 +51,26 @@ int df_main(int argc, char **argv)
#ifdef CONFIG_FEATURE_HUMAN_READABLE
opt_complementary = "h-km:k-hm:m-hk";
opt = getopt32(argc, argv, "hmk");
- if(opt & 1) {
- df_disp_hr = 0;
- disp_units_hdr = " Size";
+ if (opt & 1) {
+ df_disp_hr = 0;
+ disp_units_hdr = " Size";
}
- if(opt & 2) {
- df_disp_hr = MEGABYTE;
- disp_units_hdr = "1M-blocks";
+ if (opt & 2) {
+ df_disp_hr = MEGABYTE;
+ disp_units_hdr = "1M-blocks";
}
#else
opt = getopt32(argc, argv, "k");
#endif
- bb_printf("Filesystem%11s%-15sUsed Available Use%% Mounted on\n",
+ printf("Filesystem%11s%-15sUsed Available Use%% Mounted on\n",
"", disp_units_hdr);
mount_table = NULL;
argv += optind;
if (optind >= argc) {
- if (!(mount_table = setmntent(bb_path_mtab_file, "r"))) {
+ mount_table = setmntent(bb_path_mtab_file, "r");
+ if (!mount_table) {
bb_perror_msg_and_die(bb_path_mtab_file);
}
}
@@ -79,16 +80,19 @@ int df_main(int argc, char **argv)
const char *mount_point;
if (mount_table) {
- if (!(mount_entry = getmntent(mount_table))) {
+ mount_entry = getmntent(mount_table);
+ if (!mount_entry) {
endmntent(mount_table);
break;
}
} else {
- if (!(mount_point = *argv++)) {
+ mount_point = *argv++;
+ if (!mount_point) {
break;
}
- if (!(mount_entry = find_mount_point(mount_point, bb_path_mtab_file))) {
- bb_error_msg("%s: can't find mount point.", mount_point);
+ mount_entry = find_mount_point(mount_point, bb_path_mtab_file);
+ if (!mount_entry) {
+ bb_error_msg("%s: can't find mount point", mount_point);
SET_ERROR:
status = EXIT_FAILURE;
continue;
@@ -108,8 +112,8 @@ int df_main(int argc, char **argv)
blocks_percent_used = 0;
if (blocks_used + s.f_bavail) {
blocks_percent_used = (((long long) blocks_used) * 100
- + (blocks_used + s.f_bavail)/2
- ) / (blocks_used + s.f_bavail);
+ + (blocks_used + s.f_bavail)/2
+ ) / (blocks_used + s.f_bavail);
}
if (strcmp(device, "rootfs") == 0) {
@@ -117,24 +121,25 @@ int df_main(int argc, char **argv)
} else if (strcmp(device, "/dev/root") == 0) {
/* Adjusts device to be the real root device,
* or leaves device alone if it can't find it */
- if ((device = find_block_device("/")) == NULL) {
+ device = find_block_device("/");
+ if (!device) {
goto SET_ERROR;
}
}
#ifdef CONFIG_FEATURE_HUMAN_READABLE
- bb_printf("%-20s %9s ", device,
- make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));
+ printf("%-20s %9s ", device,
+ make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));
- bb_printf("%9s ",
- make_human_readable_str( (s.f_blocks - s.f_bfree),
- s.f_bsize, df_disp_hr));
+ printf("%9s ",
+ make_human_readable_str( (s.f_blocks - s.f_bfree),
+ s.f_bsize, df_disp_hr));
- bb_printf("%9s %3ld%% %s\n",
+ printf("%9s %3ld%% %s\n",
make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr),
blocks_percent_used, mount_point);
#else
- bb_printf("%-20s %9ld %9ld %9ld %3ld%% %s\n",
+ printf("%-20s %9ld %9ld %9ld %3ld%% %s\n",
device,
kscale(s.f_blocks, s.f_bsize),
kscale(s.f_blocks-s.f_bfree, s.f_bsize),
@@ -145,5 +150,5 @@ int df_main(int argc, char **argv)
} while (1);
- bb_fflush_stdout_and_exit(status);
+ fflush_stdout_and_exit(status);
}
diff --git a/coreutils/dirname.c b/coreutils/dirname.c
index 3471a2631..e986a9701 100644
--- a/coreutils/dirname.c
+++ b/coreutils/dirname.c
@@ -22,5 +22,5 @@ int dirname_main(int argc, char **argv)
puts(dirname(argv[1]));
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/coreutils/du.c b/coreutils/du.c
index efc449097..cae76af38 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -56,14 +56,14 @@ static void print(long size, const char * const filename)
{
/* TODO - May not want to defer error checking here. */
#ifdef CONFIG_FEATURE_HUMAN_READABLE
- bb_printf("%s\t%s\n", make_human_readable_str(size, 512, disp_hr),
+ printf("%s\t%s\n", make_human_readable_str(size, 512, disp_hr),
filename);
#else
if (disp_k) {
size++;
size >>= 1;
}
- bb_printf("%ld\t%s\n", size, filename);
+ printf("%ld\t%s\n", size, filename);
#endif
}
@@ -246,5 +246,5 @@ int du_main(int argc, char **argv)
print(total, "total");
}
- bb_fflush_stdout_and_exit(status);
+ fflush_stdout_and_exit(status);
}
diff --git a/coreutils/echo.c b/coreutils/echo.c
index d278c1143..99063ae52 100644
--- a/coreutils/echo.c
+++ b/coreutils/echo.c
@@ -115,7 +115,7 @@ just_echo:
int echo_main(int argc, char** argv)
{
(void)bb_echo(argc, argv);
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
/*-
diff --git a/coreutils/env.c b/coreutils/env.c
index d03318fea..2ce99b0ad 100644
--- a/coreutils/env.c
+++ b/coreutils/env.c
@@ -90,7 +90,7 @@ int env_main(int argc, char** argv)
puts(*ep);
}
- bb_fflush_stdout_and_exit(0);
+ fflush_stdout_and_exit(0);
}
/*
diff --git a/coreutils/expr.c b/coreutils/expr.c
index ea99d8b5b..854a657f9 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -87,11 +87,11 @@ int expr_main(int argc, char **argv)
bb_error_msg_and_die("syntax error");
if (v->type == integer)
- bb_printf("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i);
+ printf("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i);
else
puts(v->u.s);
- exit(null(v));
+ fflush_stdout_and_exit(null(v));
}
/* Return a VALUE for I. */
diff --git a/coreutils/fold.c b/coreutils/fold.c
index 45f4472e4..e33be5594 100644
--- a/coreutils/fold.c
+++ b/coreutils/fold.c
@@ -150,5 +150,5 @@ rescan:
}
} while (*++argv);
- bb_fflush_stdout_and_exit(errs);
+ fflush_stdout_and_exit(errs);
}
diff --git a/coreutils/head.c b/coreutils/head.c
index 060febcf7..2e9000df4 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -112,12 +112,13 @@ int head_main(int argc, char **argv)
#endif
do {
- if ((fp = bb_wfopen_input(*argv)) != NULL) {
+ fp = bb_wfopen_input(*argv);
+ if (fp) {
if (fp == stdin) {
*argv = (char *) bb_msg_standard_input;
}
if (header_threshhold) {
- bb_printf(fmt, *argv);
+ printf(fmt, *argv);
}
i = count;
while (i && ((c = getc(fp)) != EOF)) {
@@ -130,10 +131,10 @@ int head_main(int argc, char **argv)
bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */
retval = EXIT_FAILURE;
}
- xferror_stdout();
+ die_if_ferror_stdout();
}
fmt = header_fmt_str;
} while (*++argv);
- bb_fflush_stdout_and_exit(retval);
+ fflush_stdout_and_exit(retval);
}
diff --git a/coreutils/hostid.c b/coreutils/hostid.c
index cda96726a..65447aa63 100644
--- a/coreutils/hostid.c
+++ b/coreutils/hostid.c
@@ -19,7 +19,7 @@ int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv)
bb_show_usage();
}
- bb_printf("%lx\n", gethostid());
+ printf("%lx\n", gethostid());
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/coreutils/id.c b/coreutils/id.c
index 9d605325c..66874a71e 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -35,7 +35,7 @@ static short printf_full(unsigned int id, const char *arg, const char prefix)
fmt = "%cid=%u(%s)";
status = EXIT_SUCCESS;
}
- bb_printf(fmt, prefix, id, arg);
+ printf(fmt, prefix, id, arg);
return status;
}
@@ -74,10 +74,10 @@ int id_main(int argc, char **argv)
/* bb_getpwuid and bb_getgrgid exit on failure so puts cannot segfault */
puts((flags & JUST_USER) ? bb_getpwuid(NULL, uid, -1 ) : bb_getgrgid(NULL, gid, -1 ));
} else {
- bb_printf("%u\n", (flags & JUST_USER) ? uid : gid);
+ printf("%u\n", (flags & JUST_USER) ? uid : gid);
}
/* exit */
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
/* Print full info like GNU id */
@@ -96,16 +96,16 @@ int id_main(int argc, char **argv)
getcon(&mysid);
context[0] = '\0';
if (mysid) {
- len = strlen(mysid)+1;
- safe_strncpy(context, mysid, len);
- freecon(mysid);
+ len = strlen(mysid)+1;
+ safe_strncpy(context, mysid, len);
+ freecon(mysid);
} else {
- safe_strncpy(context, "unknown", 8);
+ safe_strncpy(context, "unknown", 8);
}
- bb_printf(" context=%s", context);
+ printf(" context=%s", context);
}
#endif
putchar('\n');
- bb_fflush_stdout_and_exit(status);
+ fflush_stdout_and_exit(status);
}
diff --git a/coreutils/logname.c b/coreutils/logname.c
index da8a1cfc9..695a736c6 100644
--- a/coreutils/logname.c
+++ b/coreutils/logname.c
@@ -35,7 +35,7 @@ int logname_main(int argc, char ATTRIBUTE_UNUSED **argv)
if ((p = getlogin()) != NULL) {
puts(p);
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
bb_perror_msg_and_die("getlogin");
diff --git a/coreutils/nice.c b/coreutils/nice.c
index dbd90648d..293861842 100644
--- a/coreutils/nice.c
+++ b/coreutils/nice.c
@@ -17,8 +17,8 @@ int nice_main(int argc, char **argv)
old_priority = getpriority(PRIO_PROCESS, 0);
if (!*++argv) { /* No args, so (GNU) output current nice value. */
- bb_printf("%d\n", old_priority);
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ printf("%d\n", old_priority);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
adjustment = 10; /* Set default adjustment. */
diff --git a/coreutils/printenv.c b/coreutils/printenv.c
index aea88d701..ec50f7151 100644
--- a/coreutils/printenv.c
+++ b/coreutils/printenv.c
@@ -37,5 +37,5 @@ int printenv_main(int argc, char **argv)
}
}
- bb_fflush_stdout_and_exit(0);
+ fflush_stdout_and_exit(0);
}
diff --git a/coreutils/pwd.c b/coreutils/pwd.c
index b2d7c0e5f..bd36d627e 100644
--- a/coreutils/pwd.c
+++ b/coreutils/pwd.c
@@ -17,7 +17,7 @@ int pwd_main(int argc, char **argv)
if ((buf = xgetcwd(NULL)) != NULL) {
puts(buf);
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
return EXIT_FAILURE;
diff --git a/coreutils/realpath.c b/coreutils/realpath.c
index 0fd2c7625..5f3242fb5 100644
--- a/coreutils/realpath.c
+++ b/coreutils/realpath.c
@@ -44,5 +44,5 @@ int realpath_main(int argc, char **argv)
RELEASE_CONFIG_BUFFER(resolved_path);
#endif
- bb_fflush_stdout_and_exit(retval);
+ fflush_stdout_and_exit(retval);
}
diff --git a/coreutils/sort.c b/coreutils/sort.c
index c23c14226..972477bab 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -318,5 +318,5 @@ int sort_main(int argc, char **argv)
/* Print it */
if(!outfile) outfile=stdout;
for(i=0;i<linecount;i++) fprintf(outfile,"%s\n",lines[i]);
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/coreutils/tee.c b/coreutils/tee.c
index a194153e0..f0e1fad86 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -85,7 +85,7 @@ int tee_main(int argc, char **argv)
* output files. Since we know that the first entry in the output
* file table is stdout, we can save one "if ferror" test by
* setting the first entry to stdin and checking stdout error
- * status with bb_fflush_stdout_and_exit()... although fflush()ing
+ * status with fflush_stdout_and_exit()... although fflush()ing
* is unnecessary here. */
p = files;
@@ -93,8 +93,8 @@ int tee_main(int argc, char **argv)
do { /* Now check for (input and) output errors. */
/* Checking ferror should be sufficient, but we may want to fclose.
* If we do, remember not to close stdin! */
- xferror(*p, filenames[(int)(p - files)]);
+ die_if_ferror(*p, filenames[(int)(p - files)]);
} while (*++p);
- bb_fflush_stdout_and_exit(retval);
+ fflush_stdout_and_exit(retval);
}
diff --git a/coreutils/tty.c b/coreutils/tty.c
index 579e6f73c..b2ab862ec 100644
--- a/coreutils/tty.c
+++ b/coreutils/tty.c
@@ -41,5 +41,5 @@ int tty_main(int argc, char **argv)
puts(s);
}
- bb_fflush_stdout_and_exit(retval);
+ fflush_stdout_and_exit(retval);
}
diff --git a/coreutils/uname.c b/coreutils/uname.c
index 575fb525c..5a3eafe92 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -91,10 +91,10 @@ int uname_main(int argc, char **argv)
strcpy(uname_info.processor, "unknown");
- delta=utsname_offset;
+ delta = utsname_offset;
do {
if (toprint & 1) {
- bb_printf(((char *)(&uname_info)) + *delta);
+ printf(((char *)(&uname_info)) + *delta);
if (toprint > 1) {
putchar(' ');
}
@@ -103,5 +103,5 @@ int uname_main(int argc, char **argv)
} while (toprint >>= 1);
putchar('\n');
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/coreutils/uniq.c b/coreutils/uniq.c
index a7b7a8e07..100f2be00 100644
--- a/coreutils/uniq.c
+++ b/coreutils/uniq.c
@@ -37,7 +37,7 @@ int uniq_main(int argc, char **argv)
while ((opt = getopt(argc, argv, uniq_opts)) > 0) {
if ((opt == 'f') || (opt == 's')) {
- int t = xatoul(optarg);
+ unsigned long t = xatoul(optarg);
if (opt == 'f') {
skip_fields = t;
} else {
@@ -71,13 +71,13 @@ int uniq_main(int argc, char **argv)
/* gnu uniq ignores newlines */
while ((s1 = xmalloc_getline(in)) != NULL) {
e1 = s1;
- for (i=skip_fields ; i ; i--) {
+ for (i = skip_fields; i; i--) {
e1 = skip_whitespace(e1);
while (*e1 && !isspace(*e1)) {
++e1;
}
}
- for (i = skip_chars ; *e1 && i ; i--) {
+ for (i = skip_chars; *e1 && i; i--) {
++e1;
}
@@ -90,14 +90,14 @@ int uniq_main(int argc, char **argv)
if (s0) {
if (!(uniq_flags & (2 << !!dups))) {
- bb_fprintf(out, "\0%d " + (uniq_flags & 1), dups + 1);
- bb_fprintf(out, "%s\n", s0);
+ fprintf(out, "\0%d " + (uniq_flags & 1), dups + 1);
+ fprintf(out, "%s\n", s0);
}
free((void *)s0);
}
} while (s1);
- xferror(in, input_filename);
+ die_if_ferror(in, input_filename);
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c
index 58538365e..e8f8d541c 100644
--- a/coreutils/uuencode.c
+++ b/coreutils/uuencode.c
@@ -47,12 +47,12 @@ int uuencode_main(int argc, char **argv)
bb_show_usage();
}
- bb_printf("begin%s %o %s", tbl == bb_uuenc_tbl_std ? "" : "-base64", mode, argv[argc - 1]);
+ printf("begin%s %o %s", tbl == bb_uuenc_tbl_std ? "" : "-base64", mode, argv[argc - 1]);
while ((size = fread(src_buf, 1, src_buf_size, src_stream)) > 0) {
if (size != src_buf_size) {
/* write_size is always 60 until the last line */
- write_size=(4 * ((size + 2) / 3));
+ write_size = (4 * ((size + 2) / 3));
/* pad with 0s so we can just encode extra bits */
memset(&src_buf[size], 0, src_buf_size - size);
}
@@ -67,9 +67,9 @@ int uuencode_main(int argc, char **argv)
bb_perror_msg_and_die(bb_msg_write_error);
}
}
- bb_printf(tbl == bb_uuenc_tbl_std ? "\n`\nend\n" : "\n====\n");
+ printf(tbl == bb_uuenc_tbl_std ? "\n`\nend\n" : "\n====\n");
- xferror(src_stream, "source"); /* TODO - Fix this! */
+ die_if_ferror(src_stream, "source"); /* TODO - Fix this! */
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/coreutils/wc.c b/coreutils/wc.c
index 359d9fd6d..ebae5f69f 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -182,12 +182,12 @@ int wc_main(int argc, char **argv)
u = 0;
do {
if (print_type & (1 << u)) {
- bb_printf(s, pcounts[u]);
+ printf(s, pcounts[u]);
s = " %9"COUNT_FMT; /* Ok... restore the leading space. */
}
totals[u] += pcounts[u];
} while (++u < 4);
- bb_printf(fname_fmt, arg);
+ printf(fname_fmt, arg);
}
/* If more than one file was processed, we want the totals. To save some
@@ -202,5 +202,5 @@ int wc_main(int argc, char **argv)
goto OUTPUT;
}
- bb_fflush_stdout_and_exit(status);
+ fflush_stdout_and_exit(status);
}
diff --git a/coreutils/whoami.c b/coreutils/whoami.c
index 5cdec922b..df714f22c 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -21,5 +21,5 @@ int whoami_main(int argc, char **argv)
puts(bb_getpwuid(NULL, geteuid(), -1));
/* exits on error */
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/coreutils/yes.c b/coreutils/yes.c
index 97b4fe54c..894506a89 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -14,8 +14,6 @@
* Size reductions and removed redundant applet name prefix from error messages.
*/
-#include <stdio.h>
-#include <stdlib.h>
#include "busybox.h"
int yes_main(int argc, char **argv)
@@ -33,7 +31,7 @@ int yes_main(int argc, char **argv)
do {
fmt = fmt_str + 1;
do {
- bb_printf(fmt, *argv);
+ printf(fmt, *argv);
fmt = fmt_str;
} while (*++argv);
argv = first_arg;