aboutsummaryrefslogtreecommitdiff
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
parent670a6626cabc1498f32b35f959591f8621d8447e (diff)
downloadbusybox-f0ed376eda5d5c25d270e5100a881fb2d801bee6.tar.gz
remove bb_printf and the like
-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
-rw-r--r--debianutils/readlink.c2
-rw-r--r--debianutils/which.c2
-rw-r--r--e2fsprogs/mke2fs.c14
-rw-r--r--include/libbb.h17
-rw-r--r--libbb/Kbuild1
-rw-r--r--libbb/fflush_stdout_and_exit.c6
-rw-r--r--libbb/getopt32.c2
-rw-r--r--libbb/xfuncs.c6
-rw-r--r--miscutils/crond.c24
-rw-r--r--miscutils/devfsd.c8
-rw-r--r--miscutils/last.c2
-rw-r--r--miscutils/less.c39
-rw-r--r--miscutils/mountpoint.c73
-rw-r--r--miscutils/rx.c2
-rw-r--r--miscutils/strings.c2
-rw-r--r--networking/route.c27
-rw-r--r--util-linux/ipcrm.c4
-rw-r--r--util-linux/ipcs.c196
48 files changed, 315 insertions, 314 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;
diff --git a/debianutils/readlink.c b/debianutils/readlink.c
index 9536d3200..400259080 100644
--- a/debianutils/readlink.c
+++ b/debianutils/readlink.c
@@ -47,5 +47,5 @@ int readlink_main(int argc, char **argv)
if (ENABLE_FEATURE_CLEAN_UP && buf != bb_common_bufsiz1)
free(buf);
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/debianutils/which.c b/debianutils/which.c
index e83c752a1..a715a2664 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -39,5 +39,5 @@ int which_main(int argc, char **argv)
status = EXIT_FAILURE;
}
- bb_fflush_stdout_and_exit(status);
+ fflush_stdout_and_exit(status);
}
diff --git a/e2fsprogs/mke2fs.c b/e2fsprogs/mke2fs.c
index 30110f8b6..1c4f1541e 100644
--- a/e2fsprogs/mke2fs.c
+++ b/e2fsprogs/mke2fs.c
@@ -177,9 +177,9 @@ static void mke2fs_error_msg_and_die(int retval, const char *fmt, ...)
if (retval) {
va_start(ap, fmt);
- bb_fprintf(stderr,"\nCould not ");
- bb_vfprintf(stderr, fmt, ap);
- bb_fprintf(stderr, "\n");
+ fprintf(stderr,"\nCould not ");
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
va_end(ap);
exit(EXIT_FAILURE);
}
@@ -192,7 +192,7 @@ static void mke2fs_verbose(const char *fmt, ...)
if (!quiet) {
va_start(ap, fmt);
- bb_vfprintf(stdout, fmt, ap);
+ vfprintf(stdout, fmt, ap);
fflush(stdout);
va_end(ap);
}
@@ -210,9 +210,9 @@ static void mke2fs_warning_msg(int retval, char *fmt, ... )
if (retval) {
va_start(ap, fmt);
- bb_fprintf(stderr,"\nWarning: ");
- bb_vfprintf(stderr, fmt, ap);
- bb_fprintf(stderr, "\n");
+ fprintf(stderr,"\nWarning: ");
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
va_end(ap);
}
}
diff --git a/include/libbb.h b/include/libbb.h
index a2267f942..f435a5915 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -227,7 +227,7 @@ extern int recursive_action(const char *fileName, int recurse,
int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData),
void* userData);
-extern int bb_parse_mode( const char* s, mode_t* theMode);
+extern int bb_parse_mode(const char* s, mode_t* theMode);
extern unsigned int tty_baud_to_value(speed_t speed);
extern speed_t tty_value_to_baud(unsigned int value);
@@ -253,7 +253,7 @@ extern FILE *bb_wfopen_input(const char *filename);
extern FILE *xfopen(const char *path, const char *mode);
extern int bb_fclose_nonstdin(FILE *f);
-extern void bb_fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN;
+extern void fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN;
extern void xstat(char *filename, struct stat *buf);
extern int xsocket(int domain, int type, int protocol);
@@ -278,17 +278,8 @@ extern const struct option *applet_long_options;
extern uint32_t option_mask32;
extern uint32_t getopt32(int argc, char **argv, const char *applet_opts, ...);
-extern int bb_vfprintf(FILE * __restrict stream, const char * __restrict format,
- va_list arg) __attribute__ ((format (printf, 2, 0)));
-extern int bb_vprintf(const char * __restrict format, va_list arg)
- __attribute__ ((format (printf, 1, 0)));
-extern int bb_fprintf(FILE * __restrict stream, const char * __restrict format, ...)
- __attribute__ ((format (printf, 2, 3)));
-extern int bb_printf(const char * __restrict format, ...)
- __attribute__ ((format (printf, 1, 2)));
-
-extern void xferror(FILE *fp, const char *fn);
-extern void xferror_stdout(void);
+extern void die_if_ferror(FILE *fp, const char *fn);
+extern void die_if_ferror_stdout(void);
extern void xfflush_stdout(void);
extern void bb_warn_ignoring_args(int n);
diff --git a/libbb/Kbuild b/libbb/Kbuild
index 3b16f5c45..0dd8c2be4 100644
--- a/libbb/Kbuild
+++ b/libbb/Kbuild
@@ -54,7 +54,6 @@ lib-$(CONFIG_DEVFSD) += xregcomp.o
lib-y += messages.o
lib-y += xfuncs.o
-lib-y += printf.o
lib-y += xatol.o
lib-y += safe_strtol.o
lib-y += bb_pwd.o
diff --git a/libbb/fflush_stdout_and_exit.c b/libbb/fflush_stdout_and_exit.c
index 6df8dde13..456ce9513 100644
--- a/libbb/fflush_stdout_and_exit.c
+++ b/libbb/fflush_stdout_and_exit.c
@@ -11,11 +11,9 @@
* in an error state.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <libbb.h>
+#include "libbb.h"
-void bb_fflush_stdout_and_exit(int retval)
+void fflush_stdout_and_exit(int retval)
{
if (fflush(stdout)) {
retval = xfunc_error_retval;
diff --git a/libbb/getopt32.c b/libbb/getopt32.c
index 967729a1b..f442933a3 100644
--- a/libbb/getopt32.c
+++ b/libbb/getopt32.c
@@ -143,7 +143,7 @@ const char *opt_complementary
while (my_b) { dosomething_with(my_b->data); my_b = my_b->link; }
if (my_b) // but llist is stored if -b is specified
free_llist(my_b);
- if (verbose_level) bb_printf("verbose level is %d\n", verbose_level);
+ if (verbose_level) printf("verbose level is %d\n", verbose_level);
Special characters:
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 0a6d90de5..c5e18c312 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -130,7 +130,7 @@ off_t xlseek(int fd, off_t offset, int whence)
}
// Die with supplied error message if this FILE * has ferror set.
-void xferror(FILE *fp, const char *fn)
+void die_if_ferror(FILE *fp, const char *fn)
{
if (ferror(fp)) {
bb_error_msg_and_die("%s", fn);
@@ -138,9 +138,9 @@ void xferror(FILE *fp, const char *fn)
}
// Die with an error message if stdout has ferror set.
-void xferror_stdout(void)
+void die_if_ferror_stdout(void)
{
- xferror(stdout, bb_msg_standard_output);
+ die_if_ferror(stdout, bb_msg_standard_output);
}
// Die with an error message if we have trouble flushing stdout.
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 4fc940b79..b18e27489 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -264,7 +264,7 @@ int crond_main(int ac, char **av)
}
}
}
- bb_fflush_stdout_and_exit(EXIT_SUCCESS); /* not reached */
+ return 0; /* not reached */
}
static int ChangeUser(const char *user)
@@ -278,7 +278,7 @@ static int ChangeUser(const char *user)
pas = getpwnam(user);
if (pas == 0) {
crondlog("\011failed to get uid for %s", user);
- return (-1);
+ return -1;
}
setenv("USER", pas->pw_name, 1);
setenv("HOME", pas->pw_dir, 1);
@@ -290,16 +290,16 @@ static int ChangeUser(const char *user)
err_msg = change_identity_e2str(pas);
if (err_msg) {
crondlog("\011%s for user %s", err_msg, user);
- return (-1);
+ return -1;
}
if (chdir(pas->pw_dir) < 0) {
crondlog("\011chdir failed: %s: %m", pas->pw_dir);
if (chdir(TMPDIR) < 0) {
crondlog("\011chdir failed: %s: %m", TMPDIR);
- return (-1);
+ return -1;
}
}
- return (pas->pw_uid);
+ return pas->pw_uid;
}
static void startlogger(void)
@@ -377,7 +377,7 @@ static char *ParseField(char *user, char *ary, int modvalue, int off,
int n2 = -1;
if (base == NULL) {
- return (NULL);
+ return NULL;
}
while (*ptr != ' ' && *ptr != '\t' && *ptr != '\n') {
@@ -420,7 +420,7 @@ static char *ParseField(char *user, char *ary, int modvalue, int off,
if (skip == 0) {
crondlog("\111failed user %s parsing %s\n", user, base);
- return (NULL);
+ return NULL;
}
if (*ptr == '-' && n2 < 0) {
++ptr;
@@ -460,7 +460,7 @@ static char *ParseField(char *user, char *ary, int modvalue, int off,
if (failsafe == 0) {
crondlog("\111failed user %s parsing %s\n", user, base);
- return (NULL);
+ return NULL;
}
}
if (*ptr != ',') {
@@ -473,7 +473,7 @@ static char *ParseField(char *user, char *ary, int modvalue, int off,
if (*ptr != ' ' && *ptr != '\t' && *ptr != '\n') {
crondlog("\111failed user %s parsing %s\n", user, base);
- return (NULL);
+ return NULL;
}
while (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') {
@@ -490,7 +490,7 @@ static char *ParseField(char *user, char *ary, int modvalue, int off,
}
#endif
- return (ptr);
+ return ptr;
}
static void FixDayDow(CronLine * line)
@@ -777,7 +777,7 @@ static int TestJobs(time_t t1, time_t t2)
}
}
}
- return (nJobs);
+ return nJobs;
}
static void RunJobs(void)
@@ -843,7 +843,7 @@ static int CheckJobs(void)
}
nStillRunning += file->cf_Running;
}
- return (nStillRunning);
+ return nStillRunning;
}
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index f1fee2c90..32973d630 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -491,9 +491,9 @@ int devfsd_main (int argc, char **argv)
if ( print_version || (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev) )
{
- bb_printf( "%s v%s\nDaemon %s:\t%d\nKernel-side %s:\t%d\n",
- applet_name,DEVFSD_VERSION,bb_msg_proto_rev,
- DEVFSD_PROTOCOL_REVISION_DAEMON,bb_msg_proto_rev, proto_rev);
+ printf( "%s v%s\nDaemon %s:\t%d\nKernel-side %s:\t%d\n",
+ applet_name,DEVFSD_VERSION,bb_msg_proto_rev,
+ DEVFSD_PROTOCOL_REVISION_DAEMON,bb_msg_proto_rev, proto_rev);
if (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev)
bb_error_msg_and_die( "%s mismatch!",bb_msg_proto_rev);
exit(EXIT_SUCCESS); /* -v */
@@ -509,7 +509,7 @@ int devfsd_main (int argc, char **argv)
if (sigaction (SIGHUP, &new_action, NULL) != 0 || sigaction (SIGUSR1, &new_action, NULL) != 0 )
devfsd_error_msg_and_die( "sigaction");
- bb_printf("%s v%s started for %s\n",applet_name, DEVFSD_VERSION, mount_point);
+ printf("%s v%s started for %s\n",applet_name, DEVFSD_VERSION, mount_point);
/* Set umask so that mknod(2), open(2) and mkdir(2) have complete control over permissions */
umask (0);
diff --git a/miscutils/last.c b/miscutils/last.c
index 9f9f639f2..668f0c17d 100644
--- a/miscutils/last.c
+++ b/miscutils/last.c
@@ -87,5 +87,5 @@ int last_main(int argc, char **argv)
ctime(&t_tmp) + 4);
}
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/miscutils/less.c b/miscutils/less.c
index 11f1d8baa..de97ba6b9 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -76,7 +76,7 @@ static int num_files = 1;
static int past_eof;
/* Command line options */
-static unsigned long flags;
+static unsigned flags;
#define FLAG_E 1
#define FLAG_M (1<<1)
#define FLAG_m (1<<2)
@@ -185,12 +185,12 @@ static void clear_line(void)
/* This adds line numbers to every line, as the -N flag necessitates */
static void add_linenumbers(void)
{
- char current_line[256];
int i;
for (i = 0; i <= num_flines; i++) {
- safe_strncpy(current_line, flines[i], 256);
- flines[i] = xasprintf("%5d %s", i + 1, current_line);
+ char *new = xasprintf("%5d %s", i + 1, flines[i]);
+ free(flines[i]);
+ flines[i] = new;
}
}
@@ -206,7 +206,7 @@ static void data_readlines(void)
strcpy(current_line, "");
fgets(current_line, 256, fp);
if (fp != stdin)
- xferror(fp, filename);
+ die_if_ferror(fp, filename);
flines = xrealloc(flines, (i+1) * sizeof(char *));
flines[i] = xstrdup(current_line);
}
@@ -243,13 +243,18 @@ static void m_status_print(void)
if (!past_eof) {
if (!line_pos) {
if (num_files > 1)
- printf("%s%s %s%i%s%i%s%i-%i/%i ", HIGHLIGHT, filename, "(file ", current_file, " of ", num_files, ") lines ", line_pos + 1, line_pos + height - 1, num_flines + 1);
+ printf("%s%s %s%i%s%i%s%i-%i/%i ", HIGHLIGHT,
+ filename, "(file ", current_file, " of ", num_files, ") lines ",
+ line_pos + 1, line_pos + height - 1, num_flines + 1);
else {
- printf("%s%s lines %i-%i/%i ", HIGHLIGHT, filename, line_pos + 1, line_pos + height - 1, num_flines + 1);
+ printf("%s%s lines %i-%i/%i ", HIGHLIGHT,
+ filename, line_pos + 1, line_pos + height - 1,
+ num_flines + 1);
}
}
else {
- printf("%s %s lines %i-%i/%i ", HIGHLIGHT, filename, line_pos + 1, line_pos + height - 1, num_flines + 1);
+ printf("%s %s lines %i-%i/%i ", HIGHLIGHT, filename,
+ line_pos + 1, line_pos + height - 1, num_flines + 1);
}
if (line_pos == num_flines - height + 2) {
@@ -263,7 +268,8 @@ static void m_status_print(void)
}
}
else {
- printf("%s%s lines %i-%i/%i (END) ", HIGHLIGHT, filename, line_pos + 1, num_flines + 1, num_flines + 1);
+ printf("%s%s lines %i-%i/%i (END) ", HIGHLIGHT, filename,
+ line_pos + 1, num_flines + 1, num_flines + 1);
if ((num_files > 1) && (current_file != num_files))
printf("- Next: %s", files[current_file]);
printf("%s", NORMAL);
@@ -300,7 +306,8 @@ static void status_print(void)
if (!line_pos) {
printf("%s%s %s", HIGHLIGHT, filename, NORMAL);
if (num_files > 1)
- printf("%s%s%i%s%i%s%s", HIGHLIGHT, "(file ", current_file, " of ", num_files, ")", NORMAL);
+ printf("%s%s%i%s%i%s%s", HIGHLIGHT, "(file ",
+ current_file, " of ", num_files, ")", NORMAL);
}
else if (line_pos == num_flines - height + 2) {
printf("%s%s %s", HIGHLIGHT, "(END)", NORMAL);
@@ -602,7 +609,7 @@ static char *process_regex_on_line(char *line, regex_t *pattern, int action)
insert_highlights if action = 1, or has the escape sequences
removed if action = 0, and then the line is returned. */
int match_status;
- char *line2 = (char *) xmalloc((sizeof(char) * (strlen(line) + 1)) + 64);
+ char *line2 = xmalloc((sizeof(char) * (strlen(line) + 1)) + 64);
char *growline = "";
regmatch_t match_structs;
@@ -616,10 +623,16 @@ static char *process_regex_on_line(char *line, regex_t *pattern, int action)
match_found = 1;
if (action) {
- growline = xasprintf("%s%.*s%s%.*s%s", growline, match_structs.rm_so, line2, HIGHLIGHT, match_structs.rm_eo - match_structs.rm_so, line2 + match_structs.rm_so, NORMAL);
+ growline = xasprintf("%s%.*s%s%.*s%s", growline,
+ match_structs.rm_so, line2, HIGHLIGHT,
+ match_structs.rm_eo - match_structs.rm_so,
+ line2 + match_structs.rm_so, NORMAL);
}
else {
- growline = xasprintf("%s%.*s%.*s", growline, match_structs.rm_so - 4, line2, match_structs.rm_eo - match_structs.rm_so, line2 + match_structs.rm_so);
+ growline = xasprintf("%s%.*s%.*s", growline,
+ match_structs.rm_so - 4, line2,
+ match_structs.rm_eo - match_structs.rm_so,
+ line2 + match_structs.rm_so);
}
line2 += match_structs.rm_eo;
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c
index dbc8fe0e9..b1bcab698 100644
--- a/miscutils/mountpoint.c
+++ b/miscutils/mountpoint.c
@@ -13,6 +13,8 @@
int mountpoint_main(int argc, char **argv)
{
+ struct stat st;
+ char *arg;
int opt = getopt32(argc, argv, "qdx");
#define OPT_q (1)
#define OPT_d (2)
@@ -20,47 +22,44 @@ int mountpoint_main(int argc, char **argv)
if (optind != argc - 1)
bb_show_usage();
- {
- char *arg = argv[optind];
- struct stat st;
- if ( (opt & OPT_x && stat(arg, &st) == 0) || (lstat(arg, &st) == 0) ) {
- if (opt & OPT_x) {
- if (S_ISBLK(st.st_mode))
- {
- bb_printf("%u:%u\n", major(st.st_rdev),
- minor(st.st_rdev));
- return EXIT_SUCCESS;
- } else {
- if (opt & OPT_q)
- putchar('\n');
- else
- bb_error_msg("%s: not a block device", arg);
- }
- return EXIT_FAILURE;
- } else
- if (S_ISDIR(st.st_mode)) {
- dev_t st_dev = st.st_dev;
- ino_t st_ino = st.st_ino;
- char *p = xasprintf("%s/..", arg);
+ arg = argv[optind];
- if (stat(p, &st) == 0) {
- short ret = (st_dev != st.st_dev) ||
- (st_dev == st.st_dev && st_ino == st.st_ino);
- if (opt & OPT_d)
- bb_printf("%u:%u\n", major(st_dev), minor(st_dev));
- else if (!(opt & OPT_q))
- bb_printf("%s is %sa mountpoint\n", arg, ret?"":"not ");
- return !ret;
- }
+ if ( (opt & OPT_x && stat(arg, &st) == 0) || (lstat(arg, &st) == 0) ) {
+ if (opt & OPT_x) {
+ if (S_ISBLK(st.st_mode)) {
+ printf("%u:%u\n", major(st.st_rdev),
+ minor(st.st_rdev));
+ return EXIT_SUCCESS;
} else {
- if (!(opt & OPT_q))
- bb_error_msg("%s: not a directory", arg);
- return EXIT_FAILURE;
+ if (opt & OPT_q)
+ putchar('\n');
+ else
+ bb_error_msg("%s: not a block device", arg);
}
+ return EXIT_FAILURE;
+ } else
+ if (S_ISDIR(st.st_mode)) {
+ dev_t st_dev = st.st_dev;
+ ino_t st_ino = st.st_ino;
+ char *p = xasprintf("%s/..", arg);
+
+ if (stat(p, &st) == 0) {
+ int ret = (st_dev != st.st_dev) ||
+ (st_dev == st.st_dev && st_ino == st.st_ino);
+ if (opt & OPT_d)
+ printf("%u:%u\n", major(st_dev), minor(st_dev));
+ else if (!(opt & OPT_q))
+ printf("%s is %sa mountpoint\n", arg, ret?"":"not ");
+ return !ret;
+ }
+ } else {
+ if (!(opt & OPT_q))
+ bb_error_msg("%s: not a directory", arg);
+ return EXIT_FAILURE;
}
- if (!(opt & OPT_q))
- bb_perror_msg("%s", arg);
- return EXIT_FAILURE;
}
+ if (!(opt & OPT_q))
+ bb_perror_msg("%s", arg);
+ return EXIT_FAILURE;
}
diff --git a/miscutils/rx.c b/miscutils/rx.c
index 00951b711..f723c1676 100644
--- a/miscutils/rx.c
+++ b/miscutils/rx.c
@@ -286,5 +286,5 @@ int rx_main(int argc, char **argv)
if (n < 0)
bb_error_msg_and_die("\nreceive failed:\n %s", error_buf);
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/miscutils/strings.c b/miscutils/strings.c
index 1ff41ad9c..dae17315e 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -84,5 +84,5 @@ PIPE:
if (ENABLE_FEATURE_CLEAN_UP)
free(string);
- bb_fflush_stdout_and_exit(status);
+ fflush_stdout_and_exit(status);
}
diff --git a/networking/route.c b/networking/route.c
index 65b40fcd6..c99405d72 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -491,7 +491,7 @@ void displayroutes(int noresolve, int netstatfmt)
FILE *fp = xfopen("/proc/net/route", "r");
- bb_printf("Kernel IP routing table\n"
+ printf("Kernel IP routing table\n"
"Destination Gateway Genmask"
" Flags %s Iface\n",
netstatfmt ? " MSS Window irtt" : "Metric Ref Use");
@@ -534,11 +534,11 @@ void displayroutes(int noresolve, int netstatfmt)
(noresolve | 0x4000), m); /* Host instead of net. */
mask.s_addr = m;
- bb_printf("%-16s%-16s%-16s%-6s", sdest, sgw, inet_ntoa(mask), flags);
+ printf("%-16s%-16s%-16s%-6s", sdest, sgw, inet_ntoa(mask), flags);
if (netstatfmt) {
- bb_printf("%5d %-5d %6d %s\n", mtu, win, ir, devname);
+ printf("%5d %-5d %6d %s\n", mtu, win, ir, devname);
} else {
- bb_printf("%-6d %-2d %7d %s\n", metric, ref, use, devname);
+ printf("%-6d %-2d %7d %s\n", metric, ref, use, devname);
}
}
}
@@ -561,7 +561,7 @@ static void INET6_displayroutes(int noresolve)
FILE *fp = xfopen("/proc/net/ipv6_route", "r");
- bb_printf("Kernel IPv6 routing table\n%-44s%-40s"
+ printf("Kernel IPv6 routing table\n%-44s%-40s"
"Flags Metric Ref Use Iface\n",
"Destination", "Next Hop");
@@ -622,7 +622,7 @@ static void INET6_displayroutes(int noresolve)
r += 40;
} else { /* 2nd pass */
/* Print the info. */
- bb_printf("%-43s %-39s %-5s %-6d %-2d %7d %-8s\n",
+ printf("%-43s %-39s %-5s %-6d %-2d %7d %-8s\n",
addr6, naddr6, flags, metric, refcnt, use, iface);
break;
}
@@ -650,15 +650,13 @@ int route_main(int argc, char **argv)
unsigned opt;
int what;
char *family;
+ char **p;
/* First, remap '-net' and '-host' to avoid getopt problems. */
- {
- char **p = argv;
-
- while (*++p) {
- if ((strcmp(*p, "-net") == 0) || (strcmp(*p, "-host") == 0)) {
- p[0][0] = '#';
- }
+ p = argv;
+ while (*++p) {
+ if ((strcmp(*p, "-net") == 0) || (strcmp(*p, "-host") == 0)) {
+ p[0][0] = '#';
}
}
@@ -685,8 +683,7 @@ int route_main(int argc, char **argv)
#endif
displayroutes(noresolve, opt & ROUTE_OPT_e);
- xferror_stdout();
- bb_fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
}
/* Check verb. At the moment, must be add, del, or delete. */
diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c
index 735a8955b..0e44783b3 100644
--- a/util-linux/ipcrm.c
+++ b/util-linux/ipcrm.c
@@ -108,8 +108,8 @@ int ipcrm_main(int argc, char **argv)
what = SEM;
if (remove_ids(what, argc-2, &argv[2]))
- bb_fflush_stdout_and_exit(1);
- bb_printf("resource(s) deleted\n");
+ fflush_stdout_and_exit(1);
+ printf("resource(s) deleted\n");
return 0;
}
}
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c
index ba81ea97c..b81d07d6d 100644
--- a/util-linux/ipcs.c
+++ b/util-linux/ipcs.c
@@ -103,25 +103,25 @@ static void print_perms(int id, struct ipc_perm *ipcp)
struct passwd *pw;
struct group *gr;
- bb_printf("%-10d %-10o", id, ipcp->mode & 0777);
+ printf("%-10d %-10o", id, ipcp->mode & 0777);
if ((pw = getpwuid(ipcp->cuid)))
- bb_printf(" %-10s", pw->pw_name);
+ printf(" %-10s", pw->pw_name);
else
- bb_printf(" %-10d", ipcp->cuid);
+ printf(" %-10d", ipcp->cuid);
if ((gr = getgrgid(ipcp->cgid)))
- bb_printf(" %-10s", gr->gr_name);
+ printf(" %-10s", gr->gr_name);
else
- bb_printf(" %-10d", ipcp->cgid);
+ printf(" %-10d", ipcp->cgid);
if ((pw = getpwuid(ipcp->uid)))
- bb_printf(" %-10s", pw->pw_name);
+ printf(" %-10s", pw->pw_name);
else
- bb_printf(" %-10d", ipcp->uid);
+ printf(" %-10d", ipcp->uid);
if ((gr = getgrgid(ipcp->gid)))
- bb_printf(" %-10s\n", gr->gr_name);
+ printf(" %-10s\n", gr->gr_name);
else
- bb_printf(" %-10d\n", ipcp->gid);
+ printf(" %-10d\n", ipcp->gid);
}
@@ -136,18 +136,18 @@ static void do_shm(void)
maxid = shmctl(0, SHM_INFO, (struct shmid_ds *) (void *) &shm_info);
if (maxid < 0) {
- bb_printf("kernel not configured for %s\n", "shared memory");
+ printf("kernel not configured for %s\n", "shared memory");
return;
}
switch (format) {
case LIMITS:
- bb_printf("------ Shared Memory %s --------\n", "Limits");
+ printf("------ Shared Memory %s --------\n", "Limits");
if ((shmctl(0, IPC_INFO, (struct shmid_ds *) (void *) &shminfo)) < 0)
return;
/* glibc 2.1.3 and all earlier libc's have ints as fields
of struct shminfo; glibc 2.1.91 has unsigned long; ach */
- bb_printf("max number of segments = %lu\n"
+ printf("max number of segments = %lu\n"
"max seg size (kbytes) = %lu\n"
"max total shared memory (pages) = %lu\n"
"min seg size (bytes) = %lu\n",
@@ -158,8 +158,8 @@ static void do_shm(void)
return;
case STATUS:
- bb_printf("------ Shared Memory %s --------\n", "Status");
- bb_printf( "segments allocated %d\n"
+ printf("------ Shared Memory %s --------\n", "Status");
+ printf( "segments allocated %d\n"
"pages allocated %ld\n"
"pages resident %ld\n"
"pages swapped %ld\n"
@@ -172,26 +172,26 @@ static void do_shm(void)
return;
case CREATOR:
- bb_printf("------ Shared Memory %s --------\n", "Segment Creators/Owners");
- bb_printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n",
+ printf("------ Shared Memory %s --------\n", "Segment Creators/Owners");
+ printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n",
"shmid", "perms", "cuid", "cgid", "uid", "gid");
break;
case TIME:
- bb_printf("------ Shared Memory %s --------\n", "Attach/Detach/Change Times");
- bb_printf( "%-10s %-10s %-20s %-20s %-20s\n",
+ printf("------ Shared Memory %s --------\n", "Attach/Detach/Change Times");
+ printf( "%-10s %-10s %-20s %-20s %-20s\n",
"shmid", "owner", "attached", "detached", "changed");
break;
case PID:
- bb_printf("------ Shared Memory %s --------\n", "Creator/Last-op");
- bb_printf( "%-10s %-10s %-10s %-10s\n",
+ printf("------ Shared Memory %s --------\n", "Creator/Last-op");
+ printf( "%-10s %-10s %-10s %-10s\n",
"shmid", "owner", "cpid", "lpid");
break;
default:
- bb_printf("------ Shared Memory %s --------\n", "Segments");
- bb_printf( "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n",
+ printf("------ Shared Memory %s --------\n", "Segments");
+ printf( "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n",
"key", "shmid", "owner", "perms", "bytes", "nattch",
"status");
break;
@@ -209,32 +209,32 @@ static void do_shm(void)
switch (format) {
case TIME:
if (pw)
- bb_printf("%-10d %-10.10s", shmid, pw->pw_name);
+ printf("%-10d %-10.10s", shmid, pw->pw_name);
else
- bb_printf("%-10d %-10d", shmid, ipcp->uid);
+ printf("%-10d %-10d", shmid, ipcp->uid);
/* ctime uses static buffer: use separate calls */
- bb_printf(" %-20.16s", shmseg.shm_atime
+ printf(" %-20.16s", shmseg.shm_atime
? ctime(&shmseg.shm_atime) + 4 : "Not set");
- bb_printf(" %-20.16s", shmseg.shm_dtime
+ printf(" %-20.16s", shmseg.shm_dtime
? ctime(&shmseg.shm_dtime) + 4 : "Not set");
- bb_printf(" %-20.16s\n", shmseg.shm_ctime
+ printf(" %-20.16s\n", shmseg.shm_ctime
? ctime(&shmseg.shm_ctime) + 4 : "Not set");
break;
case PID:
if (pw)
- bb_printf("%-10d %-10.10s", shmid, pw->pw_name);
+ printf("%-10d %-10.10s", shmid, pw->pw_name);
else
- bb_printf("%-10d %-10d", shmid, ipcp->uid);
- bb_printf(" %-10d %-10d\n", shmseg.shm_cpid, shmseg.shm_lpid);
+ printf("%-10d %-10d", shmid, ipcp->uid);
+ printf(" %-10d %-10d\n", shmseg.shm_cpid, shmseg.shm_lpid);
break;
default:
- bb_printf("0x%08x ", ipcp->KEY);
+ printf("0x%08x ", ipcp->KEY);
if (pw)
- bb_printf("%-10d %-10.10s", shmid, pw->pw_name);
+ printf("%-10d %-10.10s", shmid, pw->pw_name);
else
- bb_printf("%-10d %-10d", shmid, ipcp->uid);
- bb_printf(" %-10o %-10lu %-10ld %-6s %-6s\n", ipcp->mode & 0777,
+ printf("%-10d %-10d", shmid, ipcp->uid);
+ printf(" %-10o %-10lu %-10ld %-6s %-6s\n", ipcp->mode & 0777,
/*
* earlier: int, Austin has size_t
*/
@@ -264,17 +264,17 @@ static void do_sem(void)
arg.array = (ushort *) (void *) &seminfo;
maxid = semctl(0, 0, SEM_INFO, arg);
if (maxid < 0) {
- bb_printf("kernel not configured for %s\n", "semaphores");
+ printf("kernel not configured for %s\n", "semaphores");
return;
}
switch (format) {
case LIMITS:
- bb_printf("------ Semaphore %s --------\n", "Limits");
+ printf("------ Semaphore %s --------\n", "Limits");
arg.array = (ushort *) (void *) &seminfo; /* damn union */
if ((semctl(0, 0, IPC_INFO, arg)) < 0)
return;
- bb_printf("max number of arrays = %d\n"
+ printf("max number of arrays = %d\n"
"max semaphores per array = %d\n"
"max semaphores system wide = %d\n"
"max ops per semop call = %d\n"
@@ -285,21 +285,21 @@ static void do_sem(void)
return;
case STATUS:
- bb_printf("------ Semaphore %s --------\n", "Status");
- bb_printf( "used arrays = %d\n"
+ printf("------ Semaphore %s --------\n", "Status");
+ printf( "used arrays = %d\n"
"allocated semaphores = %d\n",
seminfo.semusz, seminfo.semaem);
return;
case CREATOR:
- bb_printf("------ Semaphore %s --------\n", "Arrays Creators/Owners");
- bb_printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n",
+ printf("------ Semaphore %s --------\n", "Arrays Creators/Owners");
+ printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n",
"semid", "perms", "cuid", "cgid", "uid", "gid");
break;
case TIME:
- bb_printf("------ Shared Memory %s --------\n", "Operation/Change Times");
- bb_printf( "%-8s %-10s %-26.24s %-26.24s\n",
+ printf("------ Shared Memory %s --------\n", "Operation/Change Times");
+ printf( "%-8s %-10s %-26.24s %-26.24s\n",
"shmid", "owner", "last-op", "last-changed");
break;
@@ -307,8 +307,8 @@ static void do_sem(void)
break;
default:
- bb_printf("------ Semaphore %s --------\n", "Arrays");
- bb_printf( "%-10s %-10s %-10s %-10s %-10s\n",
+ printf("------ Semaphore %s --------\n", "Arrays");
+ printf( "%-10s %-10s %-10s %-10s %-10s\n",
"key", "semid", "owner", "perms", "nsems");
break;
}
@@ -326,25 +326,25 @@ static void do_sem(void)
switch (format) {
case TIME:
if (pw)
- bb_printf("%-8d %-10.10s", semid, pw->pw_name);
+ printf("%-8d %-10.10s", semid, pw->pw_name);
else
- bb_printf("%-8d %-10d", semid, ipcp->uid);
+ printf("%-8d %-10d", semid, ipcp->uid);
/* ctime uses static buffer: use separate calls */
- bb_printf(" %-26.24s", semary.sem_otime
+ printf(" %-26.24s", semary.sem_otime
? ctime(&semary.sem_otime) : "Not set");
- bb_printf(" %-26.24s\n", semary.sem_ctime
+ printf(" %-26.24s\n", semary.sem_ctime
? ctime(&semary.sem_ctime) : "Not set");
break;
case PID:
break;
default:
- bb_printf("0x%08x ", ipcp->KEY);
+ printf("0x%08x ", ipcp->KEY);
if (pw)
- bb_printf("%-10d %-10.9s", semid, pw->pw_name);
+ printf("%-10d %-10.9s", semid, pw->pw_name);
else
- bb_printf("%-10d %-9d", semid, ipcp->uid);
- bb_printf(" %-10o %-10ld\n", ipcp->mode & 0777,
+ printf("%-10d %-9d", semid, ipcp->uid);
+ printf(" %-10o %-10ld\n", ipcp->mode & 0777,
/*
* glibc-2.1.3 and earlier has unsigned short;
* glibc-2.1.91 has variation between
@@ -368,7 +368,7 @@ static void do_msg(void)
maxid = msgctl(0, MSG_INFO, (struct msqid_ds *) (void *) &msginfo);
if (maxid < 0) {
- bb_printf("kernel not configured for %s\n", "message queues");
+ printf("kernel not configured for %s\n", "message queues");
return;
}
@@ -376,42 +376,42 @@ static void do_msg(void)
case LIMITS:
if ((msgctl(0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0)
return;
- bb_printf("------ Message%s --------\n", "s: Limits");
- bb_printf( "max queues system wide = %d\n"
+ printf("------ Message%s --------\n", "s: Limits");
+ printf( "max queues system wide = %d\n"
"max size of message (bytes) = %d\n"
"default max size of queue (bytes) = %d\n",
msginfo.msgmni, msginfo.msgmax, msginfo.msgmnb);
return;
case STATUS:
- bb_printf("------ Message%s --------\n", "s: Status");
- bb_printf( "allocated queues = %d\n"
+ printf("------ Message%s --------\n", "s: Status");
+ printf( "allocated queues = %d\n"
"used headers = %d\n"
"used space = %d bytes\n",
msginfo.msgpool, msginfo.msgmap, msginfo.msgtql);
return;
case CREATOR:
- bb_printf("------ Message%s --------\n", " Queues: Creators/Owners");
- bb_printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n",
+ printf("------ Message%s --------\n", " Queues: Creators/Owners");
+ printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n",
"msqid", "perms", "cuid", "cgid", "uid", "gid");
break;
case TIME:
- bb_printf("------ Message%s --------\n", " Queues Send/Recv/Change Times");
- bb_printf( "%-8s %-10s %-20s %-20s %-20s\n",
+ printf("------ Message%s --------\n", " Queues Send/Recv/Change Times");
+ printf( "%-8s %-10s %-20s %-20s %-20s\n",
"msqid", "owner", "send", "recv", "change");
break;
case PID:
- bb_printf("------ Message%s --------\n", " Queues PIDs");
- bb_printf( "%-10s %-10s %-10s %-10s\n",
+ printf("------ Message%s --------\n", " Queues PIDs");
+ printf( "%-10s %-10s %-10s %-10s\n",
"msqid", "owner", "lspid", "lrpid");
break;
default:
- bb_printf("------ Message%s --------\n", " Queues");
- bb_printf( "%-10s %-10s %-10s %-10s %-12s %-12s\n",
+ printf("------ Message%s --------\n", " Queues");
+ printf( "%-10s %-10s %-10s %-10s %-12s %-12s\n",
"key", "msqid", "owner", "perms", "used-bytes", "messages");
break;
}
@@ -428,31 +428,31 @@ static void do_msg(void)
switch (format) {
case TIME:
if (pw)
- bb_printf("%-8d %-10.10s", msqid, pw->pw_name);
+ printf("%-8d %-10.10s", msqid, pw->pw_name);
else
- bb_printf("%-8d %-10d", msqid, ipcp->uid);
- bb_printf(" %-20.16s", msgque.msg_stime
+ printf("%-8d %-10d", msqid, ipcp->uid);
+ printf(" %-20.16s", msgque.msg_stime
? ctime(&msgque.msg_stime) + 4 : "Not set");
- bb_printf(" %-20.16s", msgque.msg_rtime
+ printf(" %-20.16s", msgque.msg_rtime
? ctime(&msgque.msg_rtime) + 4 : "Not set");
- bb_printf(" %-20.16s\n", msgque.msg_ctime
+ printf(" %-20.16s\n", msgque.msg_ctime
? ctime(&msgque.msg_ctime) + 4 : "Not set");
break;
case PID:
if (pw)
- bb_printf("%-8d %-10.10s", msqid, pw->pw_name);
+ printf("%-8d %-10.10s", msqid, pw->pw_name);
else
- bb_printf("%-8d %-10d", msqid, ipcp->uid);
- bb_printf(" %5d %5d\n", msgque.msg_lspid, msgque.msg_lrpid);
+ printf("%-8d %-10d", msqid, ipcp->uid);
+ printf(" %5d %5d\n", msgque.msg_lspid, msgque.msg_lrpid);
break;
default:
- bb_printf("0x%08x ", ipcp->KEY);
+ printf("0x%08x ", ipcp->KEY);
if (pw)
- bb_printf("%-10d %-10.10s", msqid, pw->pw_name);
+ printf("%-10d %-10.10s", msqid, pw->pw_name);
else
- bb_printf("%-10d %-10d", msqid, ipcp->uid);
- bb_printf(" %-10o %-12ld %-12ld\n", ipcp->mode & 0777,
+ printf("%-10d %-10d", msqid, ipcp->uid);
+ printf(" %-10o %-12ld %-12ld\n", ipcp->mode & 0777,
/*
* glibc-2.1.3 and earlier has unsigned short;
* glibc-2.1.91 has variation between
@@ -476,7 +476,7 @@ static void print_shm(int shmid)
return;
}
- bb_printf("\nShared memory Segment shmid=%d\n"
+ printf("\nShared memory Segment shmid=%d\n"
"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n"
"mode=%#o\taccess_perms=%#o\n"
"bytes=%ld\tlpid=%d\tcpid=%d\tnattch=%ld\n",
@@ -485,11 +485,11 @@ static void print_shm(int shmid)
ipcp->mode, ipcp->mode & 0777,
(long) shmds.shm_segsz, shmds.shm_lpid, shmds.shm_cpid,
(long) shmds.shm_nattch);
- bb_printf("att_time=%-26.24s\n",
+ printf("att_time=%-26.24s\n",
shmds.shm_atime ? ctime(&shmds.shm_atime) : "Not set");
- bb_printf("det_time=%-26.24s\n",
+ printf("det_time=%-26.24s\n",
shmds.shm_dtime ? ctime(&shmds.shm_dtime) : "Not set");
- bb_printf("change_time=%-26.24s\n\n", ctime(&shmds.shm_ctime));
+ printf("change_time=%-26.24s\n\n", ctime(&shmds.shm_ctime));
}
@@ -503,7 +503,7 @@ static void print_msg(int msqid)
return;
}
- bb_printf("\nMessage Queue msqid=%d\n"
+ printf("\nMessage Queue msqid=%d\n"
"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n"
"cbytes=%ld\tqbytes=%ld\tqnum=%ld\tlspid=%d\tlrpid=%d\n",
msqid, ipcp->uid, ipcp->gid, ipcp->cuid, ipcp->cgid, ipcp->mode,
@@ -516,11 +516,11 @@ static void print_msg(int msqid)
(long) buf.msg_cbytes, (long) buf.msg_qbytes,
(long) buf.msg_qnum, buf.msg_lspid, buf.msg_lrpid);
- bb_printf("send_time=%-26.24s\n",
+ printf("send_time=%-26.24s\n",
buf.msg_stime ? ctime(&buf.msg_stime) : "Not set");
- bb_printf("rcv_time=%-26.24s\n",
+ printf("rcv_time=%-26.24s\n",
buf.msg_rtime ? ctime(&buf.msg_rtime) : "Not set");
- bb_printf("change_time=%-26.24s\n\n",
+ printf("change_time=%-26.24s\n\n",
buf.msg_ctime ? ctime(&buf.msg_ctime) : "Not set");
}
@@ -537,7 +537,7 @@ static void print_sem(int semid)
return;
}
- bb_printf("\nSemaphore Array semid=%d\n"
+ printf("\nSemaphore Array semid=%d\n"
"uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n"
"mode=%#o, access_perms=%#o\n"
"nsems = %ld\n"
@@ -547,7 +547,7 @@ static void print_sem(int semid)
ipcp->mode, ipcp->mode & 0777,
(long) semds.sem_nsems,
semds.sem_otime ? ctime(&semds.sem_otime) : "Not set");
- bb_printf("ctime = %-26.24s\n"
+ printf("ctime = %-26.24s\n"
"%-10s %-10s %-10s %-10s %-10s\n",
ctime(&semds.sem_ctime),
"semnum", "value", "ncount", "zcount", "pid");
@@ -563,9 +563,9 @@ static void print_sem(int semid)
if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) {
bb_perror_msg_and_die("semctl");
}
- bb_printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);
+ printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);
}
- bb_printf("\n");
+ puts("");
}
int ipcs_main(int argc, char **argv)
@@ -597,34 +597,34 @@ int ipcs_main(int argc, char **argv)
if (flags & flag_print) {
if (flags & flag_shm) {
print_shm(id);
- bb_fflush_stdout_and_exit(0);
+ fflush_stdout_and_exit(0);
}
if (flags & flag_sem) {
print_sem(id);
- bb_fflush_stdout_and_exit(0);
+ fflush_stdout_and_exit(0);
}
if (flags & flag_msg) {
print_msg(id);
- bb_fflush_stdout_and_exit(0);
+ fflush_stdout_and_exit(0);
}
bb_show_usage();
}
if (!(flags & (flag_shm | flag_msg | flag_sem)))
flags |= flag_msg | flag_shm | flag_sem;
- bb_printf("\n");
+ puts("");
if (flags & flag_shm) {
do_shm();
- bb_printf("\n");
+ puts("");
}
if (flags & flag_sem) {
do_sem();
- bb_printf("\n");
+ puts("");
}
if (flags & flag_msg) {
do_msg();
- bb_printf("\n");
+ puts("");
}
- return EXIT_SUCCESS;
+ fflush_stdout_and_exit(0);
}