remove bb_printf and the like
authorDenis Vlasenko <vda.linux@googlemail.com>
Thu, 26 Oct 2006 23:21:47 +0000 (23:21 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Thu, 26 Oct 2006 23:21:47 +0000 (23:21 -0000)
48 files changed:
coreutils/basename.c
coreutils/cal.c
coreutils/catv.c
coreutils/cksum.c
coreutils/cmp.c
coreutils/dd.c
coreutils/df.c
coreutils/dirname.c
coreutils/du.c
coreutils/echo.c
coreutils/env.c
coreutils/expr.c
coreutils/fold.c
coreutils/head.c
coreutils/hostid.c
coreutils/id.c
coreutils/logname.c
coreutils/nice.c
coreutils/printenv.c
coreutils/pwd.c
coreutils/realpath.c
coreutils/sort.c
coreutils/tee.c
coreutils/tty.c
coreutils/uname.c
coreutils/uniq.c
coreutils/uuencode.c
coreutils/wc.c
coreutils/whoami.c
coreutils/yes.c
debianutils/readlink.c
debianutils/which.c
e2fsprogs/mke2fs.c
include/libbb.h
libbb/Kbuild
libbb/fflush_stdout_and_exit.c
libbb/getopt32.c
libbb/xfuncs.c
miscutils/crond.c
miscutils/devfsd.c
miscutils/last.c
miscutils/less.c
miscutils/mountpoint.c
miscutils/rx.c
miscutils/strings.c
networking/route.c
util-linux/ipcrm.c
util-linux/ipcs.c

index 446f486cdcbb25312750356c59873c0c4ebb8508..30f76dc126c475b518f9604f324c8317476937a6 100644 (file)
@@ -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);
 }
index e2bc5ab126b5caa2d499857baa1f0b06ac481a99..6f5f0a434c46cdfbbdb46309ff75a57a5a86a5ce 100644 (file)
@@ -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)
index a5a8b43e41b8b028af5faa5ba77b682efd5312bc..66f30693a980ca1b6ea801979ff463a4f26b6c80 100644 (file)
@@ -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);
 }
index 9bec3bff4105ac69a19051bfb37fd52551d84f0f..3a9b0b08c4d6ddcbf3a8e9c2c08b90b3b0569bd9 100644 (file)
@@ -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);
 }
index 07858c64efa69daa7ee7a6bf6c1452e256e4035b..2b923c845e2d976c64e65c1045082959765a25d5 100644 (file)
@@ -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);
 }
index d60192e7ce1e30b45af3a22d4453b7bce5baf4c9..d72ca8b7ee8b46e4e689707df5b17d172df67580 100644 (file)
@@ -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);
index 94ead32eb36e276ade107f9dc8dc03f23c30f211..c569dae339a644656d8a9bd63fd27c910d34c5b1 100644 (file)
@@ -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);
 }
index 3471a2631b1a7599e8b73a61ae670c1fff5ec782..e986a9701b0bc8f848576e65be2e825b6e03bb19 100644 (file)
@@ -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);
 }
index efc4490974d66fea34ea27a7e11bf8cc271c4c67..cae76af3874f8d811c92a11f675a7bcd534a9669 100644 (file)
@@ -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);
 }
index d278c11434684b9528ebaa936d0564a0890e9c5b..99063ae5295a19b9daba4b064fdc0d91432b6567 100644 (file)
@@ -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);
 }
 
 /*-
index d03318feac2b946e4f3c68f0946ada4207c9ec73..2ce99b0ad805e583621f40f8752201edcb62cfe7 100644 (file)
@@ -90,7 +90,7 @@ int env_main(int argc, char** argv)
                puts(*ep);
        }
 
-       bb_fflush_stdout_and_exit(0);
+       fflush_stdout_and_exit(0);
 }
 
 /*
index ea99d8b5bd91c7713521fdd0c4e558a1d25106a0..854a657f91a3ee03a8af523570df086d77c0d33f 100644 (file)
@@ -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.  */
index 45f4472e4ae41291dc1644580a2180b85081afb5..e33be55944500872cb62b7ebc84a10cb512690a9 100644 (file)
@@ -150,5 +150,5 @@ rescan:
                }
        } while (*++argv);
 
-       bb_fflush_stdout_and_exit(errs);
+       fflush_stdout_and_exit(errs);
 }
index 060febcf716fcfcd7ceea830e567ff75ed76b0b7..2e9000df440afb5222b25bb05d5a69bee280e3b6 100644 (file)
@@ -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);
 }
index cda96726ab0775239592eb27b187c3e227c41e94..65447aa635519d5df594e56ac7b680f58be67b33 100644 (file)
@@ -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);
 }
index 9d605325c12a153db6d273925746efdf223c7e15..66874a71e68b3fe243316411492c9cd37b44a20a 100644 (file)
@@ -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);
 }
index da8a1cfc903e31529cfd99913d9a55f81fe7c605..695a736c6ba10d7d66820773eba8c815a0e4be97 100644 (file)
@@ -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");
index dbd90648d7ba2b984b6415e97a5329e0c78bfd93..293861842cc7f76db5a6199ad9c3b3bcb4daeba4 100644 (file)
@@ -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. */
index aea88d701063a62a2af6a0ed5a9414493d350965..ec50f7151efa14a8ff8f3942b625406dc14790b2 100644 (file)
@@ -37,5 +37,5 @@ int printenv_main(int argc, char **argv)
                        }
        }
 
-       bb_fflush_stdout_and_exit(0);
+       fflush_stdout_and_exit(0);
 }
index b2d7c0e5f943f2ddbdb8b0a90278cd085a5b2241..bd36d627ef65ba363a37a101e0fc798a286719c7 100644 (file)
@@ -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;
index 0fd2c76258c8251a7d8a3a62a579c31faf33514e..5f3242fb5c7e35a0c8abbb085a31915301037c90 100644 (file)
@@ -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);
 }
index c23c14226439e29172673b65cbf3fb3817e95de8..972477babf0390a23df3d1290a8658e86792c12f 100644 (file)
@@ -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);
 }
index a194153e0271bbd8f9b5cf5beca69b4dae8c4fb5..f0e1fad86fa371296f551905089774f3472fda1f 100644 (file)
@@ -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);
 }
index 579e6f73cc8f9d4dd3236951db2c2dfe27809d7a..b2ab862ec0842cbd9311c4ce37bde31f39e6c2a0 100644 (file)
@@ -41,5 +41,5 @@ int tty_main(int argc, char **argv)
                puts(s);
        }
 
-       bb_fflush_stdout_and_exit(retval);
+       fflush_stdout_and_exit(retval);
 }
index 575fb525c227c45019049cca00fa3ca8ce506e52..5a3eafe9289fbfd8124fe4c7a52bdf884fc3b349 100644 (file)
@@ -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);
 }
index a7b7a8e07d14eba06ad14fd1bee56be0217dbd9a..100f2be00596a22e8d638f2d57028ae3d424b89f 100644 (file)
@@ -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);
 }
index 58538365e900de3324f3231ffe06d08e35b99d80..e8f8d541c8e52f523e7ef7145a5faf24639c51fa 100644 (file)
@@ -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);
 }
index 359d9fd6dc8e9c2c5d524acee4aabf6cc60ca407..ebae5f69f21ed4fcdf3a6c2cfeaa981da2f60c81 100644 (file)
@@ -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);
 }
index 5cdec922b9657cc4ee9a44b0921377761824d185..df714f22ca311c0f4c41dc9c4571037522980612 100644 (file)
@@ -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);
 }
index 97b4fe54c451b173bd44f2eb7700d800cc732a2e..894506a89d53f60e99f9f188cd0bac5b7eab92fe 100644 (file)
@@ -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;
index 9536d3200a6e9b533bb320718ca4e518fa2a9608..4002590800791fde9bda3514a78df24e33cde2f8 100644 (file)
@@ -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);
 }
index e83c752a13c77bb87402c83dfd7843d777a1a7f4..a715a2664409cddd0bba1c8aa68af19e437c8fec 100644 (file)
@@ -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);
 }
index 30110f8b68d50e5999c0040c3de7fae73250319e..1c4f1541e315cc5e86b6657e681d3b5e52e6f274 100644 (file)
@@ -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);
        }
 }
index a2267f942f6f106a49ea0488ad88739357f2fa70..f435a5915fb299d8551bbf46c1fa1d3c680872ce 100644 (file)
@@ -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);
index 3b16f5c45d01d822855c95575f27c3e6d1e9ba85..0dd8c2be45cf33c4acb79097d068f25bc2507091 100644 (file)
@@ -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
index 6df8dde13b06c796f01a2a19b2234d3fb2930572..456ce95130432479e871bdcdf202dd27a93edac9 100644 (file)
  * 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;
index 967729a1bd70f3cc13886a604ec22c963b008646..f442933a3331ff46cb4978eed87ae56ffd8e7929 100644 (file)
@@ -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:
 
index 0a6d90de59bcaad864042712c667f685d29cbefa..c5e18c3128c474b505759a97d67fb17e0f4f9767 100644 (file)
@@ -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.
index 4fc940b7901660256c8ca6563b3ee6db169c4e30..b18e2748940012a63591c986ba640de34d7281fe 100644 (file)
@@ -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;
 }
 
 
index f1fee2c90e7e20eae81399b4393c306df5840802..32973d6304db60d00e20edc79be3dda1b0e35f6e 100644 (file)
@@ -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);
index 9f9f639f2cacbd6ca7c6e1d2b75f66d5871967e0..668f0c17dc5d5f36731483066394361cc50c91fb 100644 (file)
@@ -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);
 }
index 11f1d8baad3a1000e42181cc8da37563a7881127..de97ba6b93fc3bf894db7701e18dd8efe629154e 100644 (file)
@@ -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;
index dbc8fe0e965029051a70a1905b6a00940583f35a..b1bcab6989916ceef572170e004f11e5ba877e11 100644 (file)
@@ -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;
 }
index 00951b71164b3dd3c930c557e0f7fd03ad1ff20a..f723c167601b83ea29d7ba273e1663f5f584f486 100644 (file)
@@ -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);
 }
index 1ff41ad9c7c99fb9316365128a5f7278b3acc3f9..dae17315ec89c65de9b3f10faed377bbc2ba7fcf 100644 (file)
@@ -84,5 +84,5 @@ PIPE:
        if (ENABLE_FEATURE_CLEAN_UP)
                free(string);
 
-       bb_fflush_stdout_and_exit(status);
+       fflush_stdout_and_exit(status);
 }
index 65b40fcd697eef86f10088281344695ab762b699..c99405d72a540c9786011e5159d3c02aa4a0adf4 100644 (file)
@@ -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. */
index 735a8955bcc8bdda286bd1eafe5ba57fb11a198a..0e44783b3e0f2a56853e4335504ecfb6a2326cb4 100644 (file)
@@ -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;
                }
        }
index ba81ea97c6588aed648d561e7d145f996a9939df..b81d07d6d578c100c6b5300e457e496e8bcfc898 100644 (file)
@@ -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);
 }