diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-09-27 10:20:47 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-09-27 10:20:47 +0000 |
commit | 4daad9004d8f07991516970a1cbd77756fae7041 (patch) | |
tree | f1a17e4b168ef8fdf8af92ac5ce8deba89d38db2 | |
parent | 1acdc89e992eb3f0548ff48ba586b31c9a0ae232 (diff) | |
download | busybox-w32-4daad9004d8f07991516970a1cbd77756fae7041.tar.gz busybox-w32-4daad9004d8f07991516970a1cbd77756fae7041.tar.bz2 busybox-w32-4daad9004d8f07991516970a1cbd77756fae7041.zip |
introduce bb_putchar(). saves ~1800 on uclibc (less on glibc).
62 files changed, 208 insertions, 210 deletions
diff --git a/archival/gzip.c b/archival/gzip.c index bda4ae102..cabcc5ecb 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -686,7 +686,7 @@ static void check_match(IPos start, IPos match, int length) | |||
686 | if (verbose > 1) { | 686 | if (verbose > 1) { |
687 | bb_error_msg("\\[%d,%d]", start - match, length); | 687 | bb_error_msg("\\[%d,%d]", start - match, length); |
688 | do { | 688 | do { |
689 | putc(G1.window[start++], stderr); | 689 | fputc(G1.window[start++], stderr); |
690 | } while (--length != 0); | 690 | } while (--length != 0); |
691 | } | 691 | } |
692 | } | 692 | } |
diff --git a/archival/libunarchive/header_verbose_list.c b/archival/libunarchive/header_verbose_list.c index f3b0d8c5c..b9ac3c499 100644 --- a/archival/libunarchive/header_verbose_list.c +++ b/archival/libunarchive/header_verbose_list.c | |||
@@ -26,6 +26,5 @@ void header_verbose_list(const file_header_t *file_header) | |||
26 | if (file_header->link_target) { | 26 | if (file_header->link_target) { |
27 | printf(" -> %s", file_header->link_target); | 27 | printf(" -> %s", file_header->link_target); |
28 | } | 28 | } |
29 | /* putchar isnt used anywhere else i dont think */ | 29 | bb_putchar('\n'); |
30 | puts(""); | ||
31 | } | 30 | } |
diff --git a/coreutils/cal.c b/coreutils/cal.c index 35a563145..3116e1ebe 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c | |||
@@ -167,7 +167,7 @@ int cal_main(int argc, char **argv) | |||
167 | if (!julian) { | 167 | if (!julian) { |
168 | printf("%*s%s", HEAD_SEP, "", day_headings); | 168 | printf("%*s%s", HEAD_SEP, "", day_headings); |
169 | } | 169 | } |
170 | putchar('\n'); | 170 | bb_putchar('\n'); |
171 | for (row = 0; row < (6*7); row += 7) { | 171 | for (row = 0; row < (6*7); row += 7) { |
172 | for (which_cal = 0; which_cal < 3-julian; which_cal++) { | 172 | for (which_cal = 0; which_cal < 3-julian; which_cal++) { |
173 | dp = days[month + which_cal] + row; | 173 | dp = days[month + which_cal] + row; |
diff --git a/coreutils/catv.c b/coreutils/catv.c index ce927465b..5d5a5500f 100644 --- a/coreutils/catv.c +++ b/coreutils/catv.c | |||
@@ -62,13 +62,13 @@ int catv_main(int argc, char **argv) | |||
62 | if (c < 32) { | 62 | if (c < 32) { |
63 | if (c == 10) { | 63 | if (c == 10) { |
64 | if (flags & CATV_OPT_e) | 64 | if (flags & CATV_OPT_e) |
65 | putchar('$'); | 65 | bb_putchar('$'); |
66 | } else if (flags & (c==9 ? CATV_OPT_t : CATV_OPT_v)) { | 66 | } else if (flags & (c==9 ? CATV_OPT_t : CATV_OPT_v)) { |
67 | printf("^%c", c+'@'); | 67 | printf("^%c", c+'@'); |
68 | continue; | 68 | continue; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | putchar(c); | 71 | bb_putchar(c); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | if (ENABLE_FEATURE_CLEAN_UP && fd) | 74 | if (ENABLE_FEATURE_CLEAN_UP && fd) |
diff --git a/coreutils/echo.c b/coreutils/echo.c index 085e8516c..851d2efb2 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c | |||
@@ -100,18 +100,18 @@ int bb_echo(char **argv) | |||
100 | c = bb_process_escape_sequence(&arg); | 100 | c = bb_process_escape_sequence(&arg); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | putchar(c); | 103 | bb_putchar(c); |
104 | } | 104 | } |
105 | 105 | ||
106 | arg = *++argv; | 106 | arg = *++argv; |
107 | if (!arg) | 107 | if (!arg) |
108 | break; | 108 | break; |
109 | putchar(' '); | 109 | bb_putchar(' '); |
110 | } | 110 | } |
111 | 111 | ||
112 | newline_ret: | 112 | newline_ret: |
113 | if (nflag) { | 113 | if (nflag) { |
114 | putchar('\n'); | 114 | bb_putchar('\n'); |
115 | } | 115 | } |
116 | ret: | 116 | ret: |
117 | return fflush(stdout); | 117 | return fflush(stdout); |
diff --git a/coreutils/fold.c b/coreutils/fold.c index 6e422de59..a75f4666e 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c | |||
@@ -115,7 +115,7 @@ int fold_main(int argc, char **argv) | |||
115 | /* Found a blank. Don't output the part after it. */ | 115 | /* Found a blank. Don't output the part after it. */ |
116 | logical_end++; | 116 | logical_end++; |
117 | fwrite(line_out, sizeof(char), (size_t) logical_end, stdout); | 117 | fwrite(line_out, sizeof(char), (size_t) logical_end, stdout); |
118 | putchar('\n'); | 118 | bb_putchar('\n'); |
119 | /* Move the remainder to the beginning of the next line. | 119 | /* Move the remainder to the beginning of the next line. |
120 | The areas being copied here might overlap. */ | 120 | The areas being copied here might overlap. */ |
121 | memmove(line_out, line_out + logical_end, offset_out - logical_end); | 121 | memmove(line_out, line_out + logical_end, offset_out - logical_end); |
diff --git a/coreutils/id.c b/coreutils/id.c index 1cc8c4d1d..536e946c0 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
@@ -102,7 +102,7 @@ int id_main(int argc, char **argv) | |||
102 | /* Print full info like GNU id */ | 102 | /* Print full info like GNU id */ |
103 | /* bb_getpwuid(0) doesn't exit on failure (returns NULL) */ | 103 | /* bb_getpwuid(0) doesn't exit on failure (returns NULL) */ |
104 | status = printf_full(uid, bb_getpwuid(NULL, 0, uid), 'u'); | 104 | status = printf_full(uid, bb_getpwuid(NULL, 0, uid), 'u'); |
105 | putchar(' '); | 105 | bb_putchar(' '); |
106 | status |= printf_full(gid, bb_getgrgid(NULL, 0, gid), 'g'); | 106 | status |= printf_full(gid, bb_getgrgid(NULL, 0, gid), 'g'); |
107 | 107 | ||
108 | #if ENABLE_SELINUX | 108 | #if ENABLE_SELINUX |
@@ -121,6 +121,6 @@ int id_main(int argc, char **argv) | |||
121 | } | 121 | } |
122 | #endif | 122 | #endif |
123 | 123 | ||
124 | putchar('\n'); | 124 | bb_putchar('\n'); |
125 | fflush_stdout_and_exit(status); | 125 | fflush_stdout_and_exit(status); |
126 | } | 126 | } |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 4adf523d3..a4acc98ad 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -451,7 +451,7 @@ static void showdirs(struct dnode **dn, int ndirs, int first) | |||
451 | for (i = 0; i < ndirs; i++) { | 451 | for (i = 0; i < ndirs; i++) { |
452 | if (all_fmt & (DISP_DIRNAME | DISP_RECURSIVE)) { | 452 | if (all_fmt & (DISP_DIRNAME | DISP_RECURSIVE)) { |
453 | if (!first) | 453 | if (!first) |
454 | puts(""); | 454 | bb_putchar('\n'); |
455 | first = 0; | 455 | first = 0; |
456 | printf("%s:\n", dn[i]->fullname); | 456 | printf("%s:\n", dn[i]->fullname); |
457 | } | 457 | } |
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index 44d0f2db0..1bd1b0c84 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -1183,7 +1183,7 @@ dump_strings(void) | |||
1183 | case '\r': fputs("\\r", stdout); break; | 1183 | case '\r': fputs("\\r", stdout); break; |
1184 | case '\t': fputs("\\t", stdout); break; | 1184 | case '\t': fputs("\\t", stdout); break; |
1185 | case '\v': fputs("\\v", stdout); break; | 1185 | case '\v': fputs("\\v", stdout); break; |
1186 | default: putc(c, stdout); | 1186 | default: bb_putchar(c); |
1187 | } | 1187 | } |
1188 | } | 1188 | } |
1189 | putchar('\n'); | 1189 | putchar('\n'); |
diff --git a/coreutils/printf.c b/coreutils/printf.c index d0cf5a671..d5ef32e8c 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c | |||
@@ -99,9 +99,9 @@ static void print_esc_string(char *str) | |||
99 | for (; *str; str++) { | 99 | for (; *str; str++) { |
100 | if (*str == '\\') { | 100 | if (*str == '\\') { |
101 | str++; | 101 | str++; |
102 | putchar(bb_process_escape_sequence((const char **)&str)); | 102 | bb_putchar(bb_process_escape_sequence((const char **)&str)); |
103 | } else { | 103 | } else { |
104 | putchar(*str); | 104 | bb_putchar(*str); |
105 | } | 105 | } |
106 | 106 | ||
107 | } | 107 | } |
@@ -205,7 +205,7 @@ static int print_formatted(char *format, int argc, char **argv) | |||
205 | direc_length = 1; | 205 | direc_length = 1; |
206 | field_width = precision = -1; | 206 | field_width = precision = -1; |
207 | if (*f == '%') { | 207 | if (*f == '%') { |
208 | putchar('%'); | 208 | bb_putchar('%'); |
209 | break; | 209 | break; |
210 | } | 210 | } |
211 | if (*f == 'b') { | 211 | if (*f == 'b') { |
@@ -274,11 +274,11 @@ static int print_formatted(char *format, int argc, char **argv) | |||
274 | case '\\': | 274 | case '\\': |
275 | if (*++f == 'c') | 275 | if (*++f == 'c') |
276 | exit(0); | 276 | exit(0); |
277 | putchar(bb_process_escape_sequence((const char **)&f)); | 277 | bb_putchar(bb_process_escape_sequence((const char **)&f)); |
278 | f--; | 278 | f--; |
279 | break; | 279 | break; |
280 | default: | 280 | default: |
281 | putchar(*f); | 281 | bb_putchar(*f); |
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
diff --git a/coreutils/stat.c b/coreutils/stat.c index 18e8e076c..a0424d936 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -321,7 +321,7 @@ static void print_it(char const *masterformat, char const *filename, | |||
321 | b = NULL; | 321 | b = NULL; |
322 | /* fall through */ | 322 | /* fall through */ |
323 | case '%': | 323 | case '%': |
324 | putchar('%'); | 324 | bb_putchar('%'); |
325 | break; | 325 | break; |
326 | default: | 326 | default: |
327 | print_func(dest, n_alloc, *p, filename, data USE_SELINUX(,scontext)); | 327 | print_func(dest, n_alloc, *p, filename, data USE_SELINUX(,scontext)); |
@@ -552,7 +552,7 @@ static bool do_stat(char const *filename, char const *format) | |||
552 | if (option_mask32 & OPT_SELINUX) | 552 | if (option_mask32 & OPT_SELINUX) |
553 | printf(" %lc\n", *scontext); | 553 | printf(" %lc\n", *scontext); |
554 | else | 554 | else |
555 | putchar('\n'); | 555 | bb_putchar('\n'); |
556 | #endif | 556 | #endif |
557 | } else { | 557 | } else { |
558 | char *linkname = NULL; | 558 | char *linkname = NULL; |
@@ -586,7 +586,7 @@ static bool do_stat(char const *filename, char const *format) | |||
586 | (unsigned long) major(statbuf.st_rdev), | 586 | (unsigned long) major(statbuf.st_rdev), |
587 | (unsigned long) minor(statbuf.st_rdev)); | 587 | (unsigned long) minor(statbuf.st_rdev)); |
588 | else | 588 | else |
589 | putchar('\n'); | 589 | bb_putchar('\n'); |
590 | printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n", | 590 | printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n", |
591 | (unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)), | 591 | (unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)), |
592 | bb_mode_string(statbuf.st_mode), | 592 | bb_mode_string(statbuf.st_mode), |
diff --git a/coreutils/stty.c b/coreutils/stty.c index 863f28d92..1f0d4227e 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
@@ -475,10 +475,10 @@ static void wrapf(const char *message, ...) | |||
475 | G.current_col++; | 475 | G.current_col++; |
476 | if (buf[0] != '\n') { | 476 | if (buf[0] != '\n') { |
477 | if (G.current_col + buflen >= max_col) { | 477 | if (G.current_col + buflen >= max_col) { |
478 | putchar('\n'); | 478 | bb_putchar('\n'); |
479 | G.current_col = 0; | 479 | G.current_col = 0; |
480 | } else | 480 | } else |
481 | putchar(' '); | 481 | bb_putchar(' '); |
482 | } | 482 | } |
483 | } | 483 | } |
484 | fputs(buf, stdout); | 484 | fputs(buf, stdout); |
@@ -618,7 +618,7 @@ static void display_recoverable(const struct termios *mode, | |||
618 | (unsigned long) mode->c_cflag, (unsigned long) mode->c_lflag); | 618 | (unsigned long) mode->c_cflag, (unsigned long) mode->c_lflag); |
619 | for (i = 0; i < NCCS; ++i) | 619 | for (i = 0; i < NCCS; ++i) |
620 | printf(":%x", (unsigned int) mode->c_cc[i]); | 620 | printf(":%x", (unsigned int) mode->c_cc[i]); |
621 | putchar('\n'); | 621 | bb_putchar('\n'); |
622 | } | 622 | } |
623 | 623 | ||
624 | static void display_speed(const struct termios *mode, int fancy) | 624 | static void display_speed(const struct termios *mode, int fancy) |
diff --git a/coreutils/tee.c b/coreutils/tee.c index d253028cc..831325812 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -22,6 +22,7 @@ int tee_main(int argc, char **argv) | |||
22 | char **names; | 22 | char **names; |
23 | char **np; | 23 | char **np; |
24 | char retval; | 24 | char retval; |
25 | //TODO: make unconditional | ||
25 | #if ENABLE_FEATURE_TEE_USE_BLOCK_IO | 26 | #if ENABLE_FEATURE_TEE_USE_BLOCK_IO |
26 | ssize_t c; | 27 | ssize_t c; |
27 | # define buf bb_common_bufsiz1 | 28 | # define buf bb_common_bufsiz1 |
@@ -62,7 +63,7 @@ int tee_main(int argc, char **argv) | |||
62 | /* names[0] will be filled later */ | 63 | /* names[0] will be filled later */ |
63 | 64 | ||
64 | #if ENABLE_FEATURE_TEE_USE_BLOCK_IO | 65 | #if ENABLE_FEATURE_TEE_USE_BLOCK_IO |
65 | while ((c = safe_read(STDIN_FILENO, buf, BUFSIZ)) > 0) { | 66 | while ((c = safe_read(STDIN_FILENO, buf, sizeof(buf))) > 0) { |
66 | fp = files; | 67 | fp = files; |
67 | do | 68 | do |
68 | fwrite(buf, 1, c, *fp++); | 69 | fwrite(buf, 1, c, *fp++); |
diff --git a/coreutils/uname.c b/coreutils/uname.c index e4724c8f1..e70b1f9b6 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c | |||
@@ -91,12 +91,12 @@ int uname_main(int argc, char **argv) | |||
91 | if (toprint & 1) { | 91 | if (toprint & 1) { |
92 | printf(((char *)(&uname_info)) + *delta); | 92 | printf(((char *)(&uname_info)) + *delta); |
93 | if (toprint > 1) { | 93 | if (toprint > 1) { |
94 | putchar(' '); | 94 | bb_putchar(' '); |
95 | } | 95 | } |
96 | } | 96 | } |
97 | ++delta; | 97 | ++delta; |
98 | } while (toprint >>= 1); | 98 | } while (toprint >>= 1); |
99 | putchar('\n'); | 99 | bb_putchar('\n'); |
100 | 100 | ||
101 | fflush_stdout_and_exit(EXIT_SUCCESS); | 101 | fflush_stdout_and_exit(EXIT_SUCCESS); |
102 | } | 102 | } |
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index 56d68820e..17def8d9a 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c | |||
@@ -48,9 +48,9 @@ int uuencode_main(int argc, char **argv) | |||
48 | bb_perror_msg_and_die(bb_msg_read_error); | 48 | bb_perror_msg_and_die(bb_msg_read_error); |
49 | /* Encode the buffer we just read in */ | 49 | /* Encode the buffer we just read in */ |
50 | bb_uuencode(dst_buf, src_buf, size, tbl); | 50 | bb_uuencode(dst_buf, src_buf, size, tbl); |
51 | putchar('\n'); | 51 | bb_putchar('\n'); |
52 | if (tbl == bb_uuenc_tbl_std) { | 52 | if (tbl == bb_uuenc_tbl_std) { |
53 | putchar(tbl[size]); | 53 | bb_putchar(tbl[size]); |
54 | } | 54 | } |
55 | fflush(stdout); | 55 | fflush(stdout); |
56 | xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3)); | 56 | xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3)); |
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index dfcbf67dd..3717781db 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c | |||
@@ -651,7 +651,7 @@ static void execute(const char *type, const char *device, const char *mntpt, | |||
651 | mntpt ? mntpt : device); | 651 | mntpt ? mntpt : device); |
652 | for (i = 0; i < argc; i++) | 652 | for (i = 0; i < argc; i++) |
653 | printf(" %s", argv[i]); | 653 | printf(" %s", argv[i]); |
654 | puts(""); | 654 | bb_putchar('\n'); |
655 | } | 655 | } |
656 | 656 | ||
657 | /* Fork and execute the correct program. */ | 657 | /* Fork and execute the correct program. */ |
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c index dd6efc812..5f4f87276 100644 --- a/e2fsprogs/lsattr.c +++ b/e2fsprogs/lsattr.c | |||
@@ -46,7 +46,7 @@ static void list_attributes(const char *name) | |||
46 | if (option_mask32 & OPT_PF_LONG) { | 46 | if (option_mask32 & OPT_PF_LONG) { |
47 | printf("%-28s ", name); | 47 | printf("%-28s ", name); |
48 | print_flags(stdout, fsflags, PFOPT_LONG); | 48 | print_flags(stdout, fsflags, PFOPT_LONG); |
49 | puts(""); | 49 | bb_putchar('\n'); |
50 | } else { | 50 | } else { |
51 | print_flags(stdout, fsflags, 0); | 51 | print_flags(stdout, fsflags, 0); |
52 | printf(" %s\n", name); | 52 | printf(" %s\n", name); |
@@ -74,7 +74,7 @@ static int lsattr_dir_proc(const char *dir_name, struct dirent *de, | |||
74 | ) { | 74 | ) { |
75 | printf("\n%s:\n", path); | 75 | printf("\n%s:\n", path); |
76 | iterate_on_dir(path, lsattr_dir_proc, NULL); | 76 | iterate_on_dir(path, lsattr_dir_proc, NULL); |
77 | puts(""); | 77 | bb_putchar('\n'); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
diff --git a/e2fsprogs/old_e2fsprogs/blkid/dev.c b/e2fsprogs/old_e2fsprogs/blkid/dev.c index eddbd02b7..d86cc48d1 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/dev.c +++ b/e2fsprogs/old_e2fsprogs/blkid/dev.c | |||
@@ -82,7 +82,7 @@ void blkid_debug_dump_dev(blkid_dev dev) | |||
82 | else | 82 | else |
83 | printf(" tag: NULL\n"); | 83 | printf(" tag: NULL\n"); |
84 | } | 84 | } |
85 | puts(""); | 85 | bb_putchar('\n'); |
86 | } | 86 | } |
87 | #endif | 87 | #endif |
88 | 88 | ||
diff --git a/e2fsprogs/old_e2fsprogs/blkid/read.c b/e2fsprogs/old_e2fsprogs/blkid/read.c index 276e62a70..67bc8ee44 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/read.c +++ b/e2fsprogs/old_e2fsprogs/blkid/read.c | |||
@@ -436,7 +436,7 @@ static void debug_dump_dev(blkid_dev dev) | |||
436 | else | 436 | else |
437 | printf(" tag: NULL\n"); | 437 | printf(" tag: NULL\n"); |
438 | } | 438 | } |
439 | puts(""); | 439 | bb_putchar('\n'); |
440 | } | 440 | } |
441 | 441 | ||
442 | int main(int argc, char**argv) | 442 | int main(int argc, char**argv) |
diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c index 3d5b4f4fb..61db53e80 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.c +++ b/e2fsprogs/old_e2fsprogs/e2fsck.c | |||
@@ -2443,10 +2443,10 @@ static void safe_print(const char *cp, int len) | |||
2443 | ch -= 128; | 2443 | ch -= 128; |
2444 | } | 2444 | } |
2445 | if ((ch < 32) || (ch == 0x7f)) { | 2445 | if ((ch < 32) || (ch == 0x7f)) { |
2446 | fputc('^', stdout); | 2446 | bb_putchar('^'); |
2447 | ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */ | 2447 | ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */ |
2448 | } | 2448 | } |
2449 | fputc(ch, stdout); | 2449 | bb_putchar(ch); |
2450 | } | 2450 | } |
2451 | } | 2451 | } |
2452 | 2452 | ||
@@ -2497,7 +2497,7 @@ static void expand_at_expression(e2fsck_t ctx, char ch, | |||
2497 | str = _(*cpp) + 1; | 2497 | str = _(*cpp) + 1; |
2498 | if (*first && islower(*str)) { | 2498 | if (*first && islower(*str)) { |
2499 | *first = 0; | 2499 | *first = 0; |
2500 | fputc(toupper(*str++), stdout); | 2500 | bb_putchar(toupper(*str++)); |
2501 | } | 2501 | } |
2502 | print_e2fsck_message(ctx, str, pctx, *first); | 2502 | print_e2fsck_message(ctx, str, pctx, *first); |
2503 | } else | 2503 | } else |
@@ -2630,7 +2630,7 @@ static void expand_percent_expression(ext2_filsys fs, char ch, | |||
2630 | 2630 | ||
2631 | switch (ch) { | 2631 | switch (ch) { |
2632 | case '%': | 2632 | case '%': |
2633 | fputc('%', stdout); | 2633 | bb_putchar('%'); |
2634 | break; | 2634 | break; |
2635 | case 'b': | 2635 | case 'b': |
2636 | printf("%u", ctx->blk); | 2636 | printf("%u", ctx->blk); |
@@ -12767,7 +12767,7 @@ static void check_if_skip(e2fsck_t ctx) | |||
12767 | else | 12767 | else |
12768 | printf(_(" (check in %ld mounts)"), next_check); | 12768 | printf(_(" (check in %ld mounts)"), next_check); |
12769 | } | 12769 | } |
12770 | fputc('\n', stdout); | 12770 | bb_putchar('\n'); |
12771 | ext2fs_close(fs); | 12771 | ext2fs_close(fs); |
12772 | ctx->fs = NULL; | 12772 | ctx->fs = NULL; |
12773 | e2fsck_free_context(ctx); | 12773 | e2fsck_free_context(ctx); |
@@ -12864,9 +12864,9 @@ int e2fsck_simple_progress(e2fsck_t ctx, const char *label, float percent, | |||
12864 | bar + (sizeof(bar) - (i+1)), | 12864 | bar + (sizeof(bar) - (i+1)), |
12865 | spaces + (sizeof(spaces) - (dpywidth - i + 1))); | 12865 | spaces + (sizeof(spaces) - (dpywidth - i + 1))); |
12866 | if (fixed_percent == 1000) | 12866 | if (fixed_percent == 1000) |
12867 | fputc('|', stdout); | 12867 | bb_putchar('|'); |
12868 | else | 12868 | else |
12869 | fputc(spinner[ctx->progress_pos & 3], stdout); | 12869 | bb_putchar(spinner[ctx->progress_pos & 3]); |
12870 | printf(" %4.1f%% ", percent); | 12870 | printf(" %4.1f%% ", percent); |
12871 | if (dpynum) | 12871 | if (dpynum) |
12872 | printf("%u\r", dpynum); | 12872 | printf("%u\r", dpynum); |
diff --git a/e2fsprogs/old_e2fsprogs/fsck.c b/e2fsprogs/old_e2fsprogs/fsck.c index 261783726..aad85cf61 100644 --- a/e2fsprogs/old_e2fsprogs/fsck.c +++ b/e2fsprogs/old_e2fsprogs/fsck.c | |||
@@ -613,7 +613,7 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
613 | mntpt ? mntpt : device); | 613 | mntpt ? mntpt : device); |
614 | for (i=0; i < argc; i++) | 614 | for (i=0; i < argc; i++) |
615 | printf("%s ", argv[i]); | 615 | printf("%s ", argv[i]); |
616 | puts(""); | 616 | bb_putchar('\n'); |
617 | } | 617 | } |
618 | 618 | ||
619 | /* Fork and execute the correct program. */ | 619 | /* Fork and execute the correct program. */ |
diff --git a/e2fsprogs/old_e2fsprogs/lsattr.c b/e2fsprogs/old_e2fsprogs/lsattr.c index 920146496..bbc03aa9d 100644 --- a/e2fsprogs/old_e2fsprogs/lsattr.c +++ b/e2fsprogs/old_e2fsprogs/lsattr.c | |||
@@ -57,7 +57,7 @@ static void list_attributes(const char *name) | |||
57 | if (flags & OPT_PF_LONG) { | 57 | if (flags & OPT_PF_LONG) { |
58 | printf("%-28s ", name); | 58 | printf("%-28s ", name); |
59 | print_flags(stdout, fsflags, PFOPT_LONG); | 59 | print_flags(stdout, fsflags, PFOPT_LONG); |
60 | puts(""); | 60 | bb_putchar('\n'); |
61 | } else { | 61 | } else { |
62 | print_flags(stdout, fsflags, 0); | 62 | print_flags(stdout, fsflags, 0); |
63 | printf(" %s\n", name); | 63 | printf(" %s\n", name); |
@@ -102,7 +102,7 @@ static int lsattr_dir_proc(const char *dir_name, struct dirent *de, | |||
102 | (de->d_name[1] != '.' && de->d_name[2] != '\0')))) { | 102 | (de->d_name[1] != '.' && de->d_name[2] != '\0')))) { |
103 | printf("\n%s:\n", path); | 103 | printf("\n%s:\n", path); |
104 | iterate_on_dir(path, lsattr_dir_proc, NULL); | 104 | iterate_on_dir(path, lsattr_dir_proc, NULL); |
105 | puts(""); | 105 | bb_putchar('\n'); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | } | 108 | } |
diff --git a/e2fsprogs/old_e2fsprogs/mke2fs.c b/e2fsprogs/old_e2fsprogs/mke2fs.c index c1deefdb7..89b5223b7 100644 --- a/e2fsprogs/old_e2fsprogs/mke2fs.c +++ b/e2fsprogs/old_e2fsprogs/mke2fs.c | |||
@@ -641,7 +641,7 @@ static void show_stats(ext2_filsys fs) | |||
641 | s->s_blocks_per_group, s->s_frags_per_group, | 641 | s->s_blocks_per_group, s->s_frags_per_group, |
642 | s->s_inodes_per_group); | 642 | s->s_inodes_per_group); |
643 | if (fs->group_desc_count == 1) { | 643 | if (fs->group_desc_count == 1) { |
644 | puts(""); | 644 | bb_putchar('\n'); |
645 | return; | 645 | return; |
646 | } | 646 | } |
647 | 647 | ||
diff --git a/e2fsprogs/old_e2fsprogs/uuid/uuid_time.c b/e2fsprogs/old_e2fsprogs/uuid/uuid_time.c index b54d67322..b6f73e6dc 100644 --- a/e2fsprogs/old_e2fsprogs/uuid/uuid_time.c +++ b/e2fsprogs/old_e2fsprogs/uuid/uuid_time.c | |||
@@ -147,7 +147,7 @@ main(int argc, char **argv) | |||
147 | printf(" (random)\n"); | 147 | printf(" (random)\n"); |
148 | break; | 148 | break; |
149 | default: | 149 | default: |
150 | puts(""); | 150 | bb_putchar('\n'); |
151 | } | 151 | } |
152 | if (type != 1) { | 152 | if (type != 1) { |
153 | printf("Warning: not a time-based UUID, so UUID time " | 153 | printf("Warning: not a time-based UUID, so UUID time " |
diff --git a/editors/ed.c b/editors/ed.c index cd3836aed..31185d9b6 100644 --- a/editors/ed.c +++ b/editors/ed.c | |||
@@ -853,14 +853,14 @@ static int printLines(int num1, int num2, int expandFlag) | |||
853 | ch &= 0x7f; | 853 | ch &= 0x7f; |
854 | } | 854 | } |
855 | if (ch < ' ') { | 855 | if (ch < ' ') { |
856 | fputc('^', stdout); | 856 | bb_putchar('^'); |
857 | ch += '@'; | 857 | ch += '@'; |
858 | } | 858 | } |
859 | if (ch == 0x7f) { | 859 | if (ch == 0x7f) { |
860 | fputc('^', stdout); | 860 | bb_putchar('^'); |
861 | ch = '?'; | 861 | ch = '?'; |
862 | } | 862 | } |
863 | fputc(ch, stdout); | 863 | bb_putchar(ch); |
864 | } | 864 | } |
865 | 865 | ||
866 | fputs("$\n", stdout); | 866 | fputs("$\n", stdout); |
diff --git a/editors/vi.c b/editors/vi.c index 1fa7c3a09..eafe767f3 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -868,13 +868,13 @@ static void colon(char * buf) | |||
868 | if (c == '\n') { | 868 | if (c == '\n') { |
869 | write1("$\r"); | 869 | write1("$\r"); |
870 | } else if (c < ' ' || c == 127) { | 870 | } else if (c < ' ' || c == 127) { |
871 | putchar('^'); | 871 | bb_putchar('^'); |
872 | if (c == 127) | 872 | if (c == 127) |
873 | c = '?'; | 873 | c = '?'; |
874 | else | 874 | else |
875 | c += '@'; | 875 | c += '@'; |
876 | } | 876 | } |
877 | putchar(c); | 877 | bb_putchar(c); |
878 | if (c_is_no_print) | 878 | if (c_is_no_print) |
879 | standout_end(); | 879 | standout_end(); |
880 | } | 880 | } |
@@ -2337,7 +2337,7 @@ static char *get_input_line(const char * prompt) // get input line- use "status | |||
2337 | } else { | 2337 | } else { |
2338 | buf[i] = c; // save char in buffer | 2338 | buf[i] = c; // save char in buffer |
2339 | buf[i + 1] = '\0'; // make sure buffer is null terminated | 2339 | buf[i + 1] = '\0'; // make sure buffer is null terminated |
2340 | putchar(c); // echo the char back to user | 2340 | bb_putchar(c); // echo the char back to user |
2341 | i++; | 2341 | i++; |
2342 | } | 2342 | } |
2343 | } | 2343 | } |
@@ -2860,7 +2860,7 @@ static void refresh(int full_screen) | |||
2860 | char *out = sp + cs; | 2860 | char *out = sp + cs; |
2861 | 2861 | ||
2862 | while (nic-- > 0) { | 2862 | while (nic-- > 0) { |
2863 | putchar(*out); | 2863 | bb_putchar(*out); |
2864 | out++; | 2864 | out++; |
2865 | } | 2865 | } |
2866 | } | 2866 | } |
diff --git a/include/libbb.h b/include/libbb.h index 26a0f0d4a..2f5aa6077 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -391,11 +391,13 @@ ssize_t recv_from_to(int fd, void *buf, size_t len, int flags, | |||
391 | struct sockaddr *from, struct sockaddr *to, | 391 | struct sockaddr *from, struct sockaddr *to, |
392 | socklen_t sa_size); | 392 | socklen_t sa_size); |
393 | 393 | ||
394 | 394 | char *xstrdup(const char *s); | |
395 | extern char *xstrdup(const char *s); | 395 | char *xstrndup(const char *s, int n); |
396 | extern char *xstrndup(const char *s, int n); | 396 | char *safe_strncpy(char *dst, const char *src, size_t size); |
397 | extern char *safe_strncpy(char *dst, const char *src, size_t size); | 397 | /* Guaranteed to NOT be a macro (smallest code). Saves nearly 2k on uclibc. |
398 | extern char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); | 398 | /* But potentially slow, don't use in one-billion-times loops */ |
399 | int bb_putchar(int ch); | ||
400 | char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); | ||
399 | // gcc-4.1.1 still isn't good enough at optimizing it | 401 | // gcc-4.1.1 still isn't good enough at optimizing it |
400 | // (+200 bytes compared to macro) | 402 | // (+200 bytes compared to macro) |
401 | //static ALWAYS_INLINE | 403 | //static ALWAYS_INLINE |
diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c index 5ad234921..435314ea0 100644 --- a/libbb/bb_askpass.c +++ b/libbb/bb_askpass.c | |||
@@ -69,7 +69,7 @@ char *bb_askpass(int timeout, const char * prompt) | |||
69 | } | 69 | } |
70 | 70 | ||
71 | tcsetattr(STDIN_FILENO, TCSANOW, &old); | 71 | tcsetattr(STDIN_FILENO, TCSANOW, &old); |
72 | putchar('\n'); | 72 | bb_putchar('\n'); |
73 | fflush(stdout); | 73 | fflush(stdout); |
74 | return ret; | 74 | return ret; |
75 | } | 75 | } |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index a66398a95..2db85d0d4 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -111,15 +111,15 @@ static void cmdedit_set_out_char(int next_char) | |||
111 | #endif | 111 | #endif |
112 | { | 112 | { |
113 | if (initial_settings.c_lflag & ECHO) | 113 | if (initial_settings.c_lflag & ECHO) |
114 | putchar(c); | 114 | bb_putchar(c); |
115 | } | 115 | } |
116 | if (++cmdedit_x >= cmdedit_termw) { | 116 | if (++cmdedit_x >= cmdedit_termw) { |
117 | /* terminal is scrolled down */ | 117 | /* terminal is scrolled down */ |
118 | cmdedit_y++; | 118 | cmdedit_y++; |
119 | cmdedit_x = 0; | 119 | cmdedit_x = 0; |
120 | /* destroy "(auto)margin" */ | 120 | /* destroy "(auto)margin" */ |
121 | putchar(next_char); | 121 | bb_putchar(next_char); |
122 | putchar('\b'); | 122 | bb_putchar('\b'); |
123 | } | 123 | } |
124 | // Huh? What if command_ps[cursor] == '\0' (we are at the end already?) | 124 | // Huh? What if command_ps[cursor] == '\0' (we are at the end already?) |
125 | cursor++; | 125 | cursor++; |
@@ -137,7 +137,7 @@ static void goto_new_line(void) | |||
137 | { | 137 | { |
138 | input_end(); | 138 | input_end(); |
139 | if (cmdedit_x) | 139 | if (cmdedit_x) |
140 | putchar('\n'); | 140 | bb_putchar('\n'); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
@@ -149,7 +149,7 @@ static void out1str(const char *s) | |||
149 | 149 | ||
150 | static void beep(void) | 150 | static void beep(void) |
151 | { | 151 | { |
152 | putchar('\007'); | 152 | bb_putchar('\007'); |
153 | } | 153 | } |
154 | 154 | ||
155 | /* Move back one character */ | 155 | /* Move back one character */ |
@@ -197,7 +197,7 @@ static void redraw(int y, int back_cursor) | |||
197 | { | 197 | { |
198 | if (y > 0) /* up to start y */ | 198 | if (y > 0) /* up to start y */ |
199 | printf("\033[%dA", y); | 199 | printf("\033[%dA", y); |
200 | putchar('\r'); | 200 | bb_putchar('\r'); |
201 | put_prompt(); | 201 | put_prompt(); |
202 | input_end(); /* rewrite */ | 202 | input_end(); /* rewrite */ |
203 | printf("\033[J"); /* erase after cursor */ | 203 | printf("\033[J"); /* erase after cursor */ |
@@ -1585,8 +1585,8 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t | |||
1585 | beep(); | 1585 | beep(); |
1586 | else { | 1586 | else { |
1587 | *(command + cursor) = c; | 1587 | *(command + cursor) = c; |
1588 | putchar(c); | 1588 | bb_putchar(c); |
1589 | putchar('\b'); | 1589 | bb_putchar('\b'); |
1590 | } | 1590 | } |
1591 | break; | 1591 | break; |
1592 | #endif /* FEATURE_COMMAND_EDITING_VI */ | 1592 | #endif /* FEATURE_COMMAND_EDITING_VI */ |
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 2215bb8df..eb1633be2 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -456,6 +456,14 @@ off_t fdlength(int fd) | |||
456 | return pos + 1; | 456 | return pos + 1; |
457 | } | 457 | } |
458 | 458 | ||
459 | int bb_putchar(int ch) | ||
460 | { | ||
461 | /* time.c needs putc(ch, stdout), not putchar(ch). | ||
462 | * it does "stdout = stderr;", but then glibc's putchar() | ||
463 | * doesn't work as expected. bad glibc, bad */ | ||
464 | return putc(ch, stdout); | ||
465 | } | ||
466 | |||
459 | // Die with an error message if we can't malloc() enough space and do an | 467 | // Die with an error message if we can't malloc() enough space and do an |
460 | // sprintf() into that space. | 468 | // sprintf() into that space. |
461 | char *xasprintf(const char *format, ...) | 469 | char *xasprintf(const char *format, ...) |
diff --git a/loginutils/login.c b/loginutils/login.c index 7f8907543..dfdc58b30 100644 --- a/loginutils/login.c +++ b/loginutils/login.c | |||
@@ -125,7 +125,7 @@ static void die_if_nologin_and_non_root(int amroot) | |||
125 | fp = fopen("/etc/nologin", "r"); | 125 | fp = fopen("/etc/nologin", "r"); |
126 | if (fp) { | 126 | if (fp) { |
127 | while ((c = getc(fp)) != EOF) | 127 | while ((c = getc(fp)) != EOF) |
128 | putchar((c=='\n') ? '\r' : c); | 128 | bb_putchar((c=='\n') ? '\r' : c); |
129 | fflush(stdout); | 129 | fflush(stdout); |
130 | fclose(fp); | 130 | fclose(fp); |
131 | } else | 131 | } else |
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index b3c240835..396328f72 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c | |||
@@ -482,19 +482,43 @@ static void print_value_on_off(const char *str, unsigned long argp) | |||
482 | } | 482 | } |
483 | 483 | ||
484 | #if ENABLE_FEATURE_HDPARM_GET_IDENTITY | 484 | #if ENABLE_FEATURE_HDPARM_GET_IDENTITY |
485 | static void print_ascii(uint16_t *p, uint8_t length); | 485 | static void print_ascii(const char *p, int length) |
486 | { | ||
487 | #if BB_BIG_ENDIAN | ||
488 | #define LE_ONLY(x) | ||
489 | enum { ofs = 0 }; | ||
490 | #else | ||
491 | #define LE_ONLY(x) x | ||
492 | /* every 16bit word is big-endian (i.e. inverted) */ | ||
493 | /* accessing bytes in 1,0, 3,2, 5,4... sequence */ | ||
494 | int ofs = 1; | ||
495 | #endif | ||
496 | |||
497 | length *= 2; | ||
498 | /* find first non-space & print it */ | ||
499 | while (length && p[ofs] != ' ') { | ||
500 | p++; | ||
501 | LE_ONLY(ofs = -ofs;) | ||
502 | length--; | ||
503 | } | ||
504 | while (length && p[ofs]) { | ||
505 | bb_putchar(p[ofs]); | ||
506 | p++; | ||
507 | LE_ONLY(ofs = -ofs;) | ||
508 | length--; | ||
509 | } | ||
510 | bb_putchar('\n'); | ||
511 | #undef LE_ONLY | ||
512 | } | ||
486 | 513 | ||
487 | static void xprint_ascii(uint16_t *val, int i, const char *string, int n) | 514 | static void xprint_ascii(uint16_t *val, int i, const char *string, int n) |
488 | { | 515 | { |
489 | if (val[i]) { | 516 | if (val[i]) { |
490 | printf("\t%-20s", string); | 517 | printf("\t%-20s", string); |
491 | print_ascii(&val[i], n); | 518 | print_ascii((void*)&val[i], n); |
492 | } | 519 | } |
493 | } | 520 | } |
494 | #endif | ||
495 | /* end of busybox specific stuff */ | ||
496 | 521 | ||
497 | #if ENABLE_FEATURE_HDPARM_GET_IDENTITY | ||
498 | static uint8_t mode_loop(uint16_t mode_sup, uint16_t mode_sel, int cc, uint8_t *have_mode) | 522 | static uint8_t mode_loop(uint16_t mode_sup, uint16_t mode_sel, int cc, uint8_t *have_mode) |
499 | { | 523 | { |
500 | uint16_t ii; | 524 | uint16_t ii; |
@@ -515,41 +539,11 @@ static uint8_t mode_loop(uint16_t mode_sup, uint16_t mode_sel, int cc, uint8_t * | |||
515 | return err_dma; | 539 | return err_dma; |
516 | } | 540 | } |
517 | 541 | ||
518 | static void print_ascii(uint16_t *p, uint8_t length) | ||
519 | { | ||
520 | uint8_t ii; | ||
521 | char cl; | ||
522 | |||
523 | /* find first non-space & print it */ | ||
524 | for (ii = 0; ii < length; ii++) { | ||
525 | if ((char)((*p)>>8) != ' ') | ||
526 | break; | ||
527 | cl = (char)(*p); | ||
528 | if (cl != ' ') { | ||
529 | if (cl != '\0') | ||
530 | printf("%c", cl); | ||
531 | p++; | ||
532 | ii++; | ||
533 | break; | ||
534 | } | ||
535 | p++; | ||
536 | } | ||
537 | /* print the rest */ | ||
538 | for (; ii< length; ii++) { | ||
539 | if (!(*p)) | ||
540 | break; /* some older devices have NULLs */ | ||
541 | printf("%c%c", (char)((*p)>>8), (char)(*p)); | ||
542 | p++; | ||
543 | } | ||
544 | puts(""); | ||
545 | } | ||
546 | |||
547 | // Parse 512 byte disk identification block and print much crap. | 542 | // Parse 512 byte disk identification block and print much crap. |
548 | 543 | ||
549 | static void identify(uint16_t *id_supplied) | 544 | static void identify(uint16_t *val) |
550 | { | 545 | { |
551 | uint16_t buf[256]; | 546 | uint16_t ii, jj, kk; |
552 | uint16_t *val, ii, jj, kk; | ||
553 | uint16_t like_std = 1, std = 0, min_std = 0xffff; | 547 | uint16_t like_std = 1, std = 0, min_std = 0xffff; |
554 | uint16_t dev = NO_DEV, eqpt = NO_DEV; | 548 | uint16_t dev = NO_DEV, eqpt = NO_DEV; |
555 | uint8_t have_mode = 0, err_dma = 0; | 549 | uint8_t have_mode = 0, err_dma = 0; |
@@ -557,19 +551,15 @@ static void identify(uint16_t *id_supplied) | |||
557 | uint32_t ll, mm, nn, oo; | 551 | uint32_t ll, mm, nn, oo; |
558 | uint64_t bbbig; /* (:) */ | 552 | uint64_t bbbig; /* (:) */ |
559 | const char *strng; | 553 | const char *strng; |
554 | #if BB_BIG_ENDIAN | ||
555 | uint16_t buf[256]; | ||
560 | 556 | ||
561 | // Adjust for endianness if necessary. | 557 | // Adjust for endianness |
562 | 558 | swab(val, buf, sizeof(buf)); | |
563 | if (BB_BIG_ENDIAN) { | 559 | val = buf; |
564 | swab(id_supplied, buf, sizeof(buf)); | 560 | #endif |
565 | val = buf; | ||
566 | } else | ||
567 | val = id_supplied; | ||
568 | |||
569 | chksum &= 0xff; | ||
570 | |||
571 | /* check if we recognise the device type */ | 561 | /* check if we recognise the device type */ |
572 | puts(""); | 562 | bb_putchar('\n'); |
573 | if (!(val[GEN_CONFIG] & NOT_ATA)) { | 563 | if (!(val[GEN_CONFIG] & NOT_ATA)) { |
574 | dev = ATA_DEV; | 564 | dev = ATA_DEV; |
575 | printf("ATA device, with "); | 565 | printf("ATA device, with "); |
@@ -686,7 +676,7 @@ static void identify(uint16_t *id_supplied) | |||
686 | else if (like_std > std) | 676 | else if (like_std > std) |
687 | printf("& some of %u\n", like_std); | 677 | printf("& some of %u\n", like_std); |
688 | else | 678 | else |
689 | puts(""); | 679 | bb_putchar('\n'); |
690 | } else { | 680 | } else { |
691 | /* TBD: do CDROM stuff more thoroughly. For now... */ | 681 | /* TBD: do CDROM stuff more thoroughly. For now... */ |
692 | kk = 0; | 682 | kk = 0; |
@@ -786,7 +776,7 @@ static void identify(uint16_t *id_supplied) | |||
786 | if (bbbig > 1000) | 776 | if (bbbig > 1000) |
787 | printf("(%"PRIu64" GB)\n", bbbig/1000); | 777 | printf("(%"PRIu64" GB)\n", bbbig/1000); |
788 | else | 778 | else |
789 | puts(""); | 779 | bb_putchar('\n'); |
790 | } | 780 | } |
791 | 781 | ||
792 | /* hw support of commands (capabilities) */ | 782 | /* hw support of commands (capabilities) */ |
@@ -829,7 +819,7 @@ static void identify(uint16_t *id_supplied) | |||
829 | if ((like_std > 3) && ((val[CAPAB_1] & VALID) == VALID_VAL)) | 819 | if ((like_std > 3) && ((val[CAPAB_1] & VALID) == VALID_VAL)) |
830 | printf(", %s device specific minimum\n", (val[CAPAB_1] & MIN_STANDBY_TIMER) ? "with" : "no"); | 820 | printf(", %s device specific minimum\n", (val[CAPAB_1] & MIN_STANDBY_TIMER) ? "with" : "no"); |
831 | else | 821 | else |
832 | puts(""); | 822 | bb_putchar('\n'); |
833 | } | 823 | } |
834 | printf("\tR/W multiple sector transfer: "); | 824 | printf("\tR/W multiple sector transfer: "); |
835 | if ((like_std < 3) && !(val[SECTOR_XFER_MAX] & SECTOR_XFER)) | 825 | if ((like_std < 3) && !(val[SECTOR_XFER_MAX] & SECTOR_XFER)) |
@@ -866,7 +856,7 @@ static void identify(uint16_t *id_supplied) | |||
866 | printf("\tOverlap support:"); | 856 | printf("\tOverlap support:"); |
867 | if (val[PKT_REL]) printf(" %uus to release bus.", val[PKT_REL]); | 857 | if (val[PKT_REL]) printf(" %uus to release bus.", val[PKT_REL]); |
868 | if (val[SVC_NBSY]) printf(" %uus to clear BSY after SERVICE cmd.", val[SVC_NBSY]); | 858 | if (val[SVC_NBSY]) printf(" %uus to clear BSY after SERVICE cmd.", val[SVC_NBSY]); |
869 | puts(""); | 859 | bb_putchar('\n'); |
870 | } | 860 | } |
871 | } | 861 | } |
872 | 862 | ||
@@ -893,7 +883,7 @@ static void identify(uint16_t *id_supplied) | |||
893 | err_dma += mode_loop(jj, kk, 'u', &have_mode); | 883 | err_dma += mode_loop(jj, kk, 'u', &have_mode); |
894 | } | 884 | } |
895 | if (err_dma || !have_mode) printf("(?)"); | 885 | if (err_dma || !have_mode) printf("(?)"); |
896 | puts(""); | 886 | bb_putchar('\n'); |
897 | 887 | ||
898 | if ((dev == ATAPI_DEV) && (eqpt != CDROM) && (val[CAPAB_0] & DMA_IL_SUP)) | 888 | if ((dev == ATAPI_DEV) && (eqpt != CDROM) && (val[CAPAB_0] & DMA_IL_SUP)) |
899 | printf("\t\tInterleaved DMA support\n"); | 889 | printf("\t\tInterleaved DMA support\n"); |
@@ -904,7 +894,7 @@ static void identify(uint16_t *id_supplied) | |||
904 | printf("\t\tCycle time:"); | 894 | printf("\t\tCycle time:"); |
905 | if (val[DMA_TIME_MIN]) printf(" min=%uns", val[DMA_TIME_MIN]); | 895 | if (val[DMA_TIME_MIN]) printf(" min=%uns", val[DMA_TIME_MIN]); |
906 | if (val[DMA_TIME_NORM]) printf(" recommended=%uns", val[DMA_TIME_NORM]); | 896 | if (val[DMA_TIME_NORM]) printf(" recommended=%uns", val[DMA_TIME_NORM]); |
907 | puts(""); | 897 | bb_putchar('\n'); |
908 | } | 898 | } |
909 | } | 899 | } |
910 | 900 | ||
@@ -918,11 +908,11 @@ static void identify(uint16_t *id_supplied) | |||
918 | if (jj & 0x0001) printf("pio%d ", ii); | 908 | if (jj & 0x0001) printf("pio%d ", ii); |
919 | jj >>=1; | 909 | jj >>=1; |
920 | } | 910 | } |
921 | puts(""); | 911 | bb_putchar('\n'); |
922 | } else if (((min_std < 5) || (eqpt == CDROM)) && (val[PIO_MODE] & MODE)) { | 912 | } else if (((min_std < 5) || (eqpt == CDROM)) && (val[PIO_MODE] & MODE)) { |
923 | for (ii = 0; ii <= val[PIO_MODE]>>8; ii++) | 913 | for (ii = 0; ii <= val[PIO_MODE]>>8; ii++) |
924 | printf("pio%d ", ii); | 914 | printf("pio%d ", ii); |
925 | puts(""); | 915 | bb_putchar('\n'); |
926 | } else | 916 | } else |
927 | printf("unknown\n"); | 917 | printf("unknown\n"); |
928 | 918 | ||
@@ -931,7 +921,7 @@ static void identify(uint16_t *id_supplied) | |||
931 | printf("\t\tCycle time:"); | 921 | printf("\t\tCycle time:"); |
932 | if (val[PIO_NO_FLOW]) printf(" no flow control=%uns", val[PIO_NO_FLOW]); | 922 | if (val[PIO_NO_FLOW]) printf(" no flow control=%uns", val[PIO_NO_FLOW]); |
933 | if (val[PIO_FLOW]) printf(" IORDY flow control=%uns", val[PIO_FLOW]); | 923 | if (val[PIO_FLOW]) printf(" IORDY flow control=%uns", val[PIO_FLOW]); |
934 | puts(""); | 924 | bb_putchar('\n'); |
935 | } | 925 | } |
936 | } | 926 | } |
937 | 927 | ||
@@ -982,7 +972,7 @@ static void identify(uint16_t *id_supplied) | |||
982 | printf("\t"); | 972 | printf("\t"); |
983 | if (jj) printf("%umin for %sSECURITY ERASE UNIT. ", jj==ERASE_BITS ? 508 : jj<<1, ""); | 973 | if (jj) printf("%umin for %sSECURITY ERASE UNIT. ", jj==ERASE_BITS ? 508 : jj<<1, ""); |
984 | if (kk) printf("%umin for %sSECURITY ERASE UNIT. ", kk==ERASE_BITS ? 508 : kk<<1, "ENHANCED "); | 974 | if (kk) printf("%umin for %sSECURITY ERASE UNIT. ", kk==ERASE_BITS ? 508 : kk<<1, "ENHANCED "); |
985 | puts(""); | 975 | bb_putchar('\n'); |
986 | } | 976 | } |
987 | } | 977 | } |
988 | 978 | ||
@@ -1134,7 +1124,7 @@ static void dump_identity(const struct hd_driveid *id) | |||
1134 | else | 1124 | else |
1135 | printf("off"); | 1125 | printf("off"); |
1136 | } | 1126 | } |
1137 | puts(""); | 1127 | bb_putchar('\n'); |
1138 | 1128 | ||
1139 | if (!(id->field_valid & 1)) | 1129 | if (!(id->field_valid & 1)) |
1140 | printf(" (maybe):"); | 1130 | printf(" (maybe):"); |
@@ -1905,7 +1895,7 @@ static void parse_xfermode(int flag, smallint *get, smallint *set, int *value) | |||
1905 | 1895 | ||
1906 | /*------- getopt short options --------*/ | 1896 | /*------- getopt short options --------*/ |
1907 | static const char hdparm_options[] ALIGN1 = | 1897 | static const char hdparm_options[] ALIGN1 = |
1908 | "gfu::n::p:r::m::c::k::a::B:tTh" | 1898 | "gfu::n::p:r::m::c::k::a::B:tT" |
1909 | USE_FEATURE_HDPARM_GET_IDENTITY("iI") | 1899 | USE_FEATURE_HDPARM_GET_IDENTITY("iI") |
1910 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::") | 1900 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::") |
1911 | #ifdef HDIO_DRIVE_CMD | 1901 | #ifdef HDIO_DRIVE_CMD |
@@ -1933,7 +1923,6 @@ int hdparm_main(int argc, char **argv) | |||
1933 | 1923 | ||
1934 | while ((c = getopt(argc, argv, hdparm_options)) >= 0) { | 1924 | while ((c = getopt(argc, argv, hdparm_options)) >= 0) { |
1935 | flagcount++; | 1925 | flagcount++; |
1936 | if (c == 'h') bb_show_usage(); /* EXIT */ | ||
1937 | USE_FEATURE_HDPARM_GET_IDENTITY(get_IDentity |= (c == 'I')); | 1926 | USE_FEATURE_HDPARM_GET_IDENTITY(get_IDentity |= (c == 'I')); |
1938 | USE_FEATURE_HDPARM_GET_IDENTITY(get_identity |= (c == 'i')); | 1927 | USE_FEATURE_HDPARM_GET_IDENTITY(get_identity |= (c == 'i')); |
1939 | get_geom |= (c == 'g'); | 1928 | get_geom |= (c == 'g'); |
@@ -1999,7 +1988,7 @@ int hdparm_main(int argc, char **argv) | |||
1999 | if (!*argv) { | 1988 | if (!*argv) { |
2000 | if (ENABLE_FEATURE_HDPARM_GET_IDENTITY && !isatty(STDIN_FILENO)) | 1989 | if (ENABLE_FEATURE_HDPARM_GET_IDENTITY && !isatty(STDIN_FILENO)) |
2001 | identify_from_stdin(); /* EXIT */ | 1990 | identify_from_stdin(); /* EXIT */ |
2002 | else bb_show_usage(); | 1991 | bb_show_usage(); |
2003 | } | 1992 | } |
2004 | 1993 | ||
2005 | do { | 1994 | do { |
diff --git a/miscutils/less.c b/miscutils/less.c index a2221cfca..ec9c00f24 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -173,7 +173,7 @@ static void less_exit(int code) | |||
173 | * and restore it when we exit. Less does this with the | 173 | * and restore it when we exit. Less does this with the |
174 | * "ti" and "te" termcap commands; can this be done with | 174 | * "ti" and "te" termcap commands; can this be done with |
175 | * only termios.h? */ | 175 | * only termios.h? */ |
176 | putchar('\n'); | 176 | bb_putchar('\n'); |
177 | fflush_stdout_and_exit(code); | 177 | fflush_stdout_and_exit(code); |
178 | } | 178 | } |
179 | 179 | ||
@@ -419,7 +419,7 @@ static void status_print(void) | |||
419 | 419 | ||
420 | clear_line(); | 420 | clear_line(); |
421 | if (cur_fline && cur_fline < max_fline - max_displayed_line) { | 421 | if (cur_fline && cur_fline < max_fline - max_displayed_line) { |
422 | putchar(':'); | 422 | bb_putchar(':'); |
423 | return; | 423 | return; |
424 | } | 424 | } |
425 | p = "(END)"; | 425 | p = "(END)"; |
@@ -755,7 +755,7 @@ static char* less_gets(int sz) | |||
755 | continue; | 755 | continue; |
756 | if (i >= width - sz - 1) | 756 | if (i >= width - sz - 1) |
757 | continue; /* len limit */ | 757 | continue; /* len limit */ |
758 | putchar(c); | 758 | bb_putchar(c); |
759 | result[i++] = c; | 759 | result[i++] = c; |
760 | result = xrealloc(result, i+1); | 760 | result = xrealloc(result, i+1); |
761 | result[i] = '\0'; | 761 | result[i] = '\0'; |
@@ -916,7 +916,7 @@ static void regex_process(void) | |||
916 | 916 | ||
917 | /* Get the uncompiled regular expression from the user */ | 917 | /* Get the uncompiled regular expression from the user */ |
918 | clear_line(); | 918 | clear_line(); |
919 | putchar((option_mask32 & LESS_STATE_MATCH_BACKWARDS) ? '?' : '/'); | 919 | bb_putchar((option_mask32 & LESS_STATE_MATCH_BACKWARDS) ? '?' : '/'); |
920 | uncomp_regex = less_gets(1); | 920 | uncomp_regex = less_gets(1); |
921 | if (!uncomp_regex[0]) { | 921 | if (!uncomp_regex[0]) { |
922 | free(uncomp_regex); | 922 | free(uncomp_regex); |
@@ -969,7 +969,7 @@ static void number_process(int first_digit) | |||
969 | num_input[i] = less_getch(); | 969 | num_input[i] = less_getch(); |
970 | if (!num_input[i] || !isdigit(num_input[i])) | 970 | if (!num_input[i] || !isdigit(num_input[i])) |
971 | break; | 971 | break; |
972 | putchar(num_input[i]); | 972 | bb_putchar(num_input[i]); |
973 | i++; | 973 | i++; |
974 | } | 974 | } |
975 | 975 | ||
@@ -1024,7 +1024,7 @@ static void flag_change(void) | |||
1024 | int keypress; | 1024 | int keypress; |
1025 | 1025 | ||
1026 | clear_line(); | 1026 | clear_line(); |
1027 | putchar('-'); | 1027 | bb_putchar('-'); |
1028 | keypress = less_getch(); | 1028 | keypress = less_getch(); |
1029 | 1029 | ||
1030 | switch (keypress) { | 1030 | switch (keypress) { |
@@ -1049,7 +1049,7 @@ static void show_flag_status(void) | |||
1049 | int flag_val; | 1049 | int flag_val; |
1050 | 1050 | ||
1051 | clear_line(); | 1051 | clear_line(); |
1052 | putchar('_'); | 1052 | bb_putchar('_'); |
1053 | keypress = less_getch(); | 1053 | keypress = less_getch(); |
1054 | 1054 | ||
1055 | switch (keypress) { | 1055 | switch (keypress) { |
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c index 1f17adadc..0f1e155ae 100644 --- a/miscutils/mountpoint.c +++ b/miscutils/mountpoint.c | |||
@@ -34,7 +34,7 @@ int mountpoint_main(int argc, char **argv) | |||
34 | return EXIT_SUCCESS; | 34 | return EXIT_SUCCESS; |
35 | } else { | 35 | } else { |
36 | if (opt & OPT_q) | 36 | if (opt & OPT_q) |
37 | putchar('\n'); | 37 | bb_putchar('\n'); |
38 | else | 38 | else |
39 | bb_error_msg("%s: not a block device", arg); | 39 | bb_error_msg("%s: not a block device", arg); |
40 | } | 40 | } |
diff --git a/miscutils/strings.c b/miscutils/strings.c index 835880214..b7f5a0b57 100644 --- a/miscutils/strings.c +++ b/miscutils/strings.c | |||
@@ -56,7 +56,7 @@ int strings_main(int argc, char **argv) | |||
56 | c = fgetc(file); | 56 | c = fgetc(file); |
57 | if (isprint(c) || c == '\t') { | 57 | if (isprint(c) || c == '\t') { |
58 | if (count > n) { | 58 | if (count > n) { |
59 | putchar(c); | 59 | bb_putchar(c); |
60 | } else { | 60 | } else { |
61 | string[count] = c; | 61 | string[count] = c; |
62 | if (count == n) { | 62 | if (count == n) { |
@@ -72,7 +72,7 @@ int strings_main(int argc, char **argv) | |||
72 | } | 72 | } |
73 | } else { | 73 | } else { |
74 | if (count > n) { | 74 | if (count > n) { |
75 | putchar('\n'); | 75 | bb_putchar('\n'); |
76 | } | 76 | } |
77 | count = 0; | 77 | count = 0; |
78 | } | 78 | } |
diff --git a/miscutils/time.c b/miscutils/time.c index e8473f702..8f79a51ec 100644 --- a/miscutils/time.c +++ b/miscutils/time.c | |||
@@ -188,8 +188,6 @@ static void summarize(const char *fmt, char **command, resource_t * resp) | |||
188 | #endif | 188 | #endif |
189 | if (!cpu_ticks) cpu_ticks = 1; /* we divide by it, must be nonzero */ | 189 | if (!cpu_ticks) cpu_ticks = 1; /* we divide by it, must be nonzero */ |
190 | 190 | ||
191 | /* putchar() != putc(stdout) in glibc! */ | ||
192 | |||
193 | while (*fmt) { | 191 | while (*fmt) { |
194 | /* Handle leading literal part */ | 192 | /* Handle leading literal part */ |
195 | int n = strcspn(fmt, "%\\"); | 193 | int n = strcspn(fmt, "%\\"); |
@@ -205,7 +203,7 @@ static void summarize(const char *fmt, char **command, resource_t * resp) | |||
205 | /* Usually we optimize for size, but there is a limit | 203 | /* Usually we optimize for size, but there is a limit |
206 | * for everything. With this we do a lot of 1-byte writes */ | 204 | * for everything. With this we do a lot of 1-byte writes */ |
207 | default: | 205 | default: |
208 | putc(*fmt, stdout); | 206 | bb_putchar(*fmt); |
209 | break; | 207 | break; |
210 | #endif | 208 | #endif |
211 | 209 | ||
@@ -215,11 +213,11 @@ static void summarize(const char *fmt, char **command, resource_t * resp) | |||
215 | /* Our format strings do not have these */ | 213 | /* Our format strings do not have these */ |
216 | /* and we do not take format str from user */ | 214 | /* and we do not take format str from user */ |
217 | default: | 215 | default: |
218 | putc('%', stdout); | 216 | bb_putchar('%'); |
219 | /*FALLTHROUGH*/ | 217 | /*FALLTHROUGH*/ |
220 | case '%': | 218 | case '%': |
221 | if (!*fmt) goto ret; | 219 | if (!*fmt) goto ret; |
222 | putc(*fmt, stdout); | 220 | bb_putchar(*fmt); |
223 | break; | 221 | break; |
224 | #endif | 222 | #endif |
225 | case 'C': /* The command that got timed. */ | 223 | case 'C': /* The command that got timed. */ |
@@ -351,17 +349,17 @@ static void summarize(const char *fmt, char **command, resource_t * resp) | |||
351 | case '\\': /* Format escape. */ | 349 | case '\\': /* Format escape. */ |
352 | switch (*++fmt) { | 350 | switch (*++fmt) { |
353 | default: | 351 | default: |
354 | putc('\\', stdout); | 352 | bb_putchar('\\'); |
355 | /*FALLTHROUGH*/ | 353 | /*FALLTHROUGH*/ |
356 | case '\\': | 354 | case '\\': |
357 | if (!*fmt) goto ret; | 355 | if (!*fmt) goto ret; |
358 | putc(*fmt, stdout); | 356 | bb_putchar(*fmt); |
359 | break; | 357 | break; |
360 | case 't': | 358 | case 't': |
361 | putc('\t', stdout); | 359 | bb_putchar('\t'); |
362 | break; | 360 | break; |
363 | case 'n': | 361 | case 'n': |
364 | putc('\n', stdout); | 362 | bb_putchar('\n'); |
365 | break; | 363 | break; |
366 | } | 364 | } |
367 | break; | 365 | break; |
@@ -370,7 +368,7 @@ static void summarize(const char *fmt, char **command, resource_t * resp) | |||
370 | ++fmt; | 368 | ++fmt; |
371 | } | 369 | } |
372 | /* ret: */ | 370 | /* ret: */ |
373 | putc('\n', stdout); | 371 | bb_putchar('\n'); |
374 | } | 372 | } |
375 | 373 | ||
376 | /* Run command CMD and return statistics on it. | 374 | /* Run command CMD and return statistics on it. |
@@ -437,6 +435,7 @@ int time_main(int argc, char **argv) | |||
437 | run_command(argv, &res); | 435 | run_command(argv, &res); |
438 | 436 | ||
439 | /* Cheat. printf's are shorter :) */ | 437 | /* Cheat. printf's are shorter :) */ |
438 | /* (but see bb_putchar() body for additional wrinkle!) */ | ||
440 | stdout = stderr; | 439 | stdout = stderr; |
441 | dup2(2, 1); /* just in case libc does something silly :( */ | 440 | dup2(2, 1); /* just in case libc does something silly :( */ |
442 | summarize(output_format, argv, &res); | 441 | summarize(output_format, argv, &res); |
diff --git a/miscutils/ttysize.c b/miscutils/ttysize.c index 5a3f5dcd4..292cfb876 100644 --- a/miscutils/ttysize.c +++ b/miscutils/ttysize.c | |||
@@ -39,6 +39,6 @@ int ttysize_main(int argc, char **argv) | |||
39 | fmt = "%u %u" + 2; /* " %u" */ | 39 | fmt = "%u %u" + 2; /* " %u" */ |
40 | } | 40 | } |
41 | } | 41 | } |
42 | putchar('\n'); | 42 | bb_putchar('\n'); |
43 | return 0; | 43 | return 0; |
44 | } | 44 | } |
diff --git a/modutils/lsmod.c b/modutils/lsmod.c index 01e1c5539..09b03d029 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | 16 | ||
17 | #if !ENABLE_FEATURE_CHECK_TAINTED_MODULE | 17 | #if !ENABLE_FEATURE_CHECK_TAINTED_MODULE |
18 | static void check_tainted(void) { puts(""); } | 18 | static void check_tainted(void) { bb_putchar('\n'); } |
19 | #else | 19 | #else |
20 | #define TAINT_FILENAME "/proc/sys/kernel/tainted" | 20 | #define TAINT_FILENAME "/proc/sys/kernel/tainted" |
21 | #define TAINT_PROPRIETORY_MODULE (1<<0) | 21 | #define TAINT_PROPRIETORY_MODULE (1<<0) |
@@ -128,7 +128,7 @@ int lsmod_main(int argc, char **argv) | |||
128 | } | 128 | } |
129 | if (count) printf("]"); | 129 | if (count) printf("]"); |
130 | 130 | ||
131 | puts(""); | 131 | bb_putchar('\n'); |
132 | } | 132 | } |
133 | 133 | ||
134 | #if ENABLE_FEATURE_CLEAN_UP | 134 | #if ENABLE_FEATURE_CLEAN_UP |
@@ -178,7 +178,7 @@ int lsmod_main(int argc, char **argv) | |||
178 | } | 178 | } |
179 | printf(" %s", tok); | 179 | printf(" %s", tok); |
180 | } | 180 | } |
181 | puts(""); | 181 | bb_putchar('\n'); |
182 | free(line); | 182 | free(line); |
183 | } | 183 | } |
184 | fclose(file); | 184 | fclose(file); |
diff --git a/networking/ether-wake.c b/networking/ether-wake.c index 36713837a..fc26ad07d 100644 --- a/networking/ether-wake.c +++ b/networking/ether-wake.c | |||
@@ -92,7 +92,7 @@ void bb_debug_dump_packet(unsigned char *outpack, int pktsize) | |||
92 | printf("packet dump:\n"); | 92 | printf("packet dump:\n"); |
93 | for (i = 0; i < pktsize; ++i) { | 93 | for (i = 0; i < pktsize; ++i) { |
94 | printf("%2.2x ", outpack[i]); | 94 | printf("%2.2x ", outpack[i]); |
95 | if (i % 20 == 19) puts(""); | 95 | if (i % 20 == 19) bb_putchar('\n'); |
96 | } | 96 | } |
97 | printf("\n\n"); | 97 | printf("\n\n"); |
98 | } | 98 | } |
diff --git a/networking/hostname.c b/networking/hostname.c index 95dc4515d..6783dbacb 100644 --- a/networking/hostname.c +++ b/networking/hostname.c | |||
@@ -83,7 +83,7 @@ int hostname_main(int argc, char **argv) | |||
83 | while (hp->h_addr_list[0]) { | 83 | while (hp->h_addr_list[0]) { |
84 | printf("%s ", inet_ntoa(*(struct in_addr *) (*hp->h_addr_list++))); | 84 | printf("%s ", inet_ntoa(*(struct in_addr *) (*hp->h_addr_list++))); |
85 | } | 85 | } |
86 | puts(""); | 86 | bb_putchar('\n'); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | /* Set the hostname */ | 89 | /* Set the hostname */ |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 299d36346..02e13ed27 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -1259,7 +1259,7 @@ int ifupdown_main(int argc, char **argv) | |||
1259 | iface_list = iface_list->link; | 1259 | iface_list = iface_list->link; |
1260 | } | 1260 | } |
1261 | if (VERBOSE) { | 1261 | if (VERBOSE) { |
1262 | puts(""); | 1262 | bb_putchar('\n'); |
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | if (!okay && !FORCE) { | 1265 | if (!okay && !FORCE) { |
diff --git a/networking/interface.c b/networking/interface.c index 61ce12ef1..471ac529e 100644 --- a/networking/interface.c +++ b/networking/interface.c | |||
@@ -937,7 +937,7 @@ static void ife_print(struct interface *ptr) | |||
937 | printf("(auto)"); | 937 | printf("(auto)"); |
938 | } | 938 | } |
939 | #endif | 939 | #endif |
940 | puts(""); | 940 | bb_putchar('\n'); |
941 | 941 | ||
942 | if (ptr->has_ip) { | 942 | if (ptr->has_ip) { |
943 | printf(" %s addr:%s ", ap->name, | 943 | printf(" %s addr:%s ", ap->name, |
@@ -1073,7 +1073,7 @@ static void ife_print(struct interface *ptr) | |||
1073 | if (ptr->outfill || ptr->keepalive) | 1073 | if (ptr->outfill || ptr->keepalive) |
1074 | printf(" Outfill:%d Keepalive:%d", ptr->outfill, ptr->keepalive); | 1074 | printf(" Outfill:%d Keepalive:%d", ptr->outfill, ptr->keepalive); |
1075 | #endif | 1075 | #endif |
1076 | puts(""); | 1076 | bb_putchar('\n'); |
1077 | 1077 | ||
1078 | /* If needed, display the interface statistics. */ | 1078 | /* If needed, display the interface statistics. */ |
1079 | 1079 | ||
@@ -1122,9 +1122,9 @@ static void ife_print(struct interface *ptr) | |||
1122 | } | 1122 | } |
1123 | if (ptr->map.dma) | 1123 | if (ptr->map.dma) |
1124 | printf("DMA chan:%x ", ptr->map.dma); | 1124 | printf("DMA chan:%x ", ptr->map.dma); |
1125 | puts(""); | 1125 | bb_putchar('\n'); |
1126 | } | 1126 | } |
1127 | puts(""); | 1127 | bb_putchar('\n'); |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | 1130 | ||
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index 2b1713556..a936a4275 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c | |||
@@ -482,7 +482,7 @@ static void do_tunnels_list(struct ip_tunnel_parm *p) | |||
482 | (p->i_key && p1.i_key != p->i_key)) | 482 | (p->i_key && p1.i_key != p->i_key)) |
483 | continue; | 483 | continue; |
484 | print_tunnel(&p1); | 484 | print_tunnel(&p1); |
485 | puts(""); | 485 | bb_putchar('\n'); |
486 | } | 486 | } |
487 | } | 487 | } |
488 | 488 | ||
@@ -512,7 +512,7 @@ static int do_show(int argc, char **argv) | |||
512 | return -1; | 512 | return -1; |
513 | 513 | ||
514 | print_tunnel(&p); | 514 | print_tunnel(&p); |
515 | puts(""); | 515 | bb_putchar('\n'); |
516 | return 0; | 516 | return 0; |
517 | } | 517 | } |
518 | 518 | ||
diff --git a/networking/nslookup.c b/networking/nslookup.c index 0036d0d17..e5bb56f81 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c | |||
@@ -112,7 +112,7 @@ static void server_print(void) | |||
112 | print_host(server, "Server:"); | 112 | print_host(server, "Server:"); |
113 | if (ENABLE_FEATURE_CLEAN_UP) | 113 | if (ENABLE_FEATURE_CLEAN_UP) |
114 | free(server); | 114 | free(server); |
115 | puts(""); | 115 | bb_putchar('\n'); |
116 | } | 116 | } |
117 | 117 | ||
118 | /* alter the global _res nameserver structure to use | 118 | /* alter the global _res nameserver structure to use |
diff --git a/networking/traceroute.c b/networking/traceroute.c index 2d09c7197..e8d486f4c 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c | |||
@@ -1322,7 +1322,7 @@ int traceroute_main(int argc, char **argv) | |||
1322 | printf(" *"); | 1322 | printf(" *"); |
1323 | (void)fflush(stdout); | 1323 | (void)fflush(stdout); |
1324 | } | 1324 | } |
1325 | putchar('\n'); | 1325 | bb_putchar('\n'); |
1326 | if (got_there || | 1326 | if (got_there || |
1327 | (unreachable > 0 && unreachable >= nprobes - 1)) | 1327 | (unreachable > 0 && unreachable >= nprobes - 1)) |
1328 | break; | 1328 | break; |
diff --git a/networking/wget.c b/networking/wget.c index 86d6f00ec..df1a45b2a 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -142,7 +142,7 @@ static void progressmeter(int flag) | |||
142 | /* last call to progressmeter */ | 142 | /* last call to progressmeter */ |
143 | alarm(0); | 143 | alarm(0); |
144 | transferred = 0; | 144 | transferred = 0; |
145 | putc('\n', stderr); | 145 | fputc('\n', stderr); |
146 | } else { | 146 | } else { |
147 | if (flag == -1) { | 147 | if (flag == -1) { |
148 | /* first call to progressmeter */ | 148 | /* first call to progressmeter */ |
diff --git a/procps/fuser.c b/procps/fuser.c index f65b05d98..60c10956b 100644 --- a/procps/fuser.c +++ b/procps/fuser.c | |||
@@ -292,7 +292,7 @@ static int fuser_print_pid_list(pid_list *plist) | |||
292 | printf("%d ", curr->pid); | 292 | printf("%d ", curr->pid); |
293 | curr = curr->next; | 293 | curr = curr->next; |
294 | } | 294 | } |
295 | puts(""); | 295 | bb_putchar('\n'); |
296 | return 1; | 296 | return 1; |
297 | } | 297 | } |
298 | 298 | ||
diff --git a/procps/pidof.c b/procps/pidof.c index c989076bb..962945253 100644 --- a/procps/pidof.c +++ b/procps/pidof.c | |||
@@ -76,7 +76,7 @@ int pidof_main(int argc, char **argv) | |||
76 | free(pidList); | 76 | free(pidList); |
77 | optind++; | 77 | optind++; |
78 | } | 78 | } |
79 | putchar('\n'); | 79 | bb_putchar('\n'); |
80 | 80 | ||
81 | #if ENABLE_FEATURE_PIDOF_OMIT | 81 | #if ENABLE_FEATURE_PIDOF_OMIT |
82 | if (ENABLE_FEATURE_CLEAN_UP) | 82 | if (ENABLE_FEATURE_CLEAN_UP) |
diff --git a/procps/top.c b/procps/top.c index e55cecccb..1b8c18516 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -482,7 +482,7 @@ static NOINLINE void display_process_list(int count, int scr_width) | |||
482 | s++; | 482 | s++; |
483 | } | 483 | } |
484 | /* printf(" %d", hist_iterations); */ | 484 | /* printf(" %d", hist_iterations); */ |
485 | putchar(OPT_BATCH_MODE ? '\n' : '\r'); | 485 | bb_putchar(OPT_BATCH_MODE ? '\n' : '\r'); |
486 | fflush(stdout); | 486 | fflush(stdout); |
487 | } | 487 | } |
488 | #undef UPSCALE | 488 | #undef UPSCALE |
@@ -752,7 +752,7 @@ static NOINLINE void display_topmem_process_list(int count, int scr_width) | |||
752 | printf("\n""%.*s", scr_width, line_buf); | 752 | printf("\n""%.*s", scr_width, line_buf); |
753 | s++; | 753 | s++; |
754 | } | 754 | } |
755 | putchar(OPT_BATCH_MODE ? '\n' : '\r'); | 755 | bb_putchar(OPT_BATCH_MODE ? '\n' : '\r'); |
756 | fflush(stdout); | 756 | fflush(stdout); |
757 | #undef HDR_STR | 757 | #undef HDR_STR |
758 | #undef MIN_WIDTH | 758 | #undef MIN_WIDTH |
@@ -972,6 +972,6 @@ int top_main(int argc, char **argv) | |||
972 | } | 972 | } |
973 | #endif /* FEATURE_USE_TERMIOS */ | 973 | #endif /* FEATURE_USE_TERMIOS */ |
974 | } | 974 | } |
975 | putchar('\n'); | 975 | bb_putchar('\n'); |
976 | return EXIT_SUCCESS; | 976 | return EXIT_SUCCESS; |
977 | } | 977 | } |
diff --git a/runit/sv.c b/runit/sv.c index 406dc6fc8..7283bbf7d 100644 --- a/runit/sv.c +++ b/runit/sv.c | |||
@@ -179,7 +179,7 @@ static void out(const char *p, const char *m1) | |||
179 | if (errno) { | 179 | if (errno) { |
180 | printf(": %s", strerror(errno)); | 180 | printf(": %s", strerror(errno)); |
181 | } | 181 | } |
182 | puts(""); /* will also flush the output */ | 182 | bb_putchar('\n'); /* will also flush the output */ |
183 | } | 183 | } |
184 | 184 | ||
185 | #define WARN "warning: " | 185 | #define WARN "warning: " |
@@ -300,7 +300,7 @@ static int status(const char *unused) | |||
300 | printf("; "); | 300 | printf("; "); |
301 | svstatus_print("log"); | 301 | svstatus_print("log"); |
302 | } | 302 | } |
303 | puts(""); /* will also flush the output */ | 303 | bb_putchar('\n'); /* will also flush the output */ |
304 | return r; | 304 | return r; |
305 | } | 305 | } |
306 | 306 | ||
@@ -372,7 +372,7 @@ static int check(const char *a) | |||
372 | } | 372 | } |
373 | printf(OK); | 373 | printf(OK); |
374 | svstatus_print(*service); | 374 | svstatus_print(*service); |
375 | puts(""); /* will also flush the output */ | 375 | bb_putchar('\n'); /* will also flush the output */ |
376 | return 1; | 376 | return 1; |
377 | } | 377 | } |
378 | 378 | ||
@@ -571,7 +571,7 @@ int sv_main(int argc, char **argv) | |||
571 | svstatus_print(*service); | 571 | svstatus_print(*service); |
572 | ++rc; | 572 | ++rc; |
573 | } | 573 | } |
574 | puts(""); /* will also flush the output */ | 574 | bb_putchar('\n'); /* will also flush the output */ |
575 | if (kll) | 575 | if (kll) |
576 | control("k"); | 576 | control("k"); |
577 | nullify_service: | 577 | nullify_service: |
diff --git a/selinux/getsebool.c b/selinux/getsebool.c index 06a298061..598a51cc0 100644 --- a/selinux/getsebool.c +++ b/selinux/getsebool.c | |||
@@ -53,7 +53,7 @@ int getsebool_main(int argc, char **argv) | |||
53 | printf("%s --> %s", names[i], (active ? "on" : "off")); | 53 | printf("%s --> %s", names[i], (active ? "on" : "off")); |
54 | if (pending != active) | 54 | if (pending != active) |
55 | printf(" pending: %s", (pending ? "on" : "off")); | 55 | printf(" pending: %s", (pending ? "on" : "off")); |
56 | putchar('\n'); | 56 | bb_putchar('\n'); |
57 | } | 57 | } |
58 | 58 | ||
59 | if (ENABLE_FEATURE_CLEAN_UP) { | 59 | if (ENABLE_FEATURE_CLEAN_UP) { |
diff --git a/selinux/setfiles.c b/selinux/setfiles.c index 174d4ce60..befb68ff6 100644 --- a/selinux/setfiles.c +++ b/selinux/setfiles.c | |||
@@ -284,8 +284,8 @@ static int restore(const char *file) | |||
284 | if (count % 0x400 == 0) { /* every 1024 times */ | 284 | if (count % 0x400 == 0) { /* every 1024 times */ |
285 | count = (count % (80*0x400)); | 285 | count = (count % (80*0x400)); |
286 | if (count == 0) | 286 | if (count == 0) |
287 | fputc('\n', stdout); | 287 | bb_putchar('\n'); |
288 | fputc('*', stdout); | 288 | bb_putchar('*'); |
289 | fflush(stdout); | 289 | fflush(stdout); |
290 | } | 290 | } |
291 | } | 291 | } |
diff --git a/shell/hush.c b/shell/hush.c index 5796f1127..5f9f2c5c1 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -2004,7 +2004,7 @@ static int run_list_real(struct pipe *pi) | |||
2004 | insert_bg_job(pi); | 2004 | insert_bg_job(pi); |
2005 | } else { | 2005 | } else { |
2006 | /* ctrl-C. We just stop doing whatever we were doing */ | 2006 | /* ctrl-C. We just stop doing whatever we were doing */ |
2007 | putchar('\n'); | 2007 | bb_putchar('\n'); |
2008 | } | 2008 | } |
2009 | rcode = 0; | 2009 | rcode = 0; |
2010 | goto ret; | 2010 | goto ret; |
diff --git a/shell/lash.c b/shell/lash.c index 889fe49d8..4ce6d4235 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -319,7 +319,7 @@ static int builtin_help(struct child_prog ATTRIBUTE_UNUSED *dummy) | |||
319 | continue; | 319 | continue; |
320 | printf("%s\t%s\n", x->cmd, x->descr); | 320 | printf("%s\t%s\n", x->cmd, x->descr); |
321 | } | 321 | } |
322 | putchar('\n'); | 322 | bb_putchar('\n'); |
323 | return EXIT_SUCCESS; | 323 | return EXIT_SUCCESS; |
324 | } | 324 | } |
325 | 325 | ||
@@ -677,7 +677,7 @@ static int get_command_bufsiz(FILE * source, char *command) | |||
677 | 677 | ||
678 | if (!fgets(command, BUFSIZ - 2, source)) { | 678 | if (!fgets(command, BUFSIZ - 2, source)) { |
679 | if (source == stdin) | 679 | if (source == stdin) |
680 | puts(""); | 680 | bb_putchar('\n'); |
681 | return 1; | 681 | return 1; |
682 | } | 682 | } |
683 | 683 | ||
diff --git a/shell/msh.c b/shell/msh.c index f1b3f0525..41fe1b6ba 100644 --- a/shell/msh.c +++ b/shell/msh.c | |||
@@ -1137,7 +1137,7 @@ static void nameval(struct var *vp, const char *val, const char *name) | |||
1137 | if (vp->status & RONLY) { | 1137 | if (vp->status & RONLY) { |
1138 | xp = vp->name; | 1138 | xp = vp->name; |
1139 | while (*xp && *xp != '=') | 1139 | while (*xp && *xp != '=') |
1140 | putc(*xp++, stderr); | 1140 | fputc(*xp++, stderr); |
1141 | err(" is read-only"); | 1141 | err(" is read-only"); |
1142 | return; | 1142 | return; |
1143 | } | 1143 | } |
@@ -3181,7 +3181,7 @@ static int dohelp(struct op *t) | |||
3181 | while (x->name) { | 3181 | while (x->name) { |
3182 | col += printf("%c%s", ((col == 0) ? '\t' : ' '), x->name); | 3182 | col += printf("%c%s", ((col == 0) ? '\t' : ' '), x->name); |
3183 | if (col > 60) { | 3183 | if (col > 60) { |
3184 | puts(""); | 3184 | bb_putchar('\n'); |
3185 | col = 0; | 3185 | col = 0; |
3186 | } | 3186 | } |
3187 | x++; | 3187 | x++; |
@@ -3193,7 +3193,7 @@ static int dohelp(struct op *t) | |||
3193 | while (applet->name) { | 3193 | while (applet->name) { |
3194 | col += printf("%c%s", ((col == 0) ? '\t' : ' '), applet->name); | 3194 | col += printf("%c%s", ((col == 0) ? '\t' : ' '), applet->name); |
3195 | if (col > 60) { | 3195 | if (col > 60) { |
3196 | puts(""); | 3196 | bb_putchar('\n'); |
3197 | col = 0; | 3197 | col = 0; |
3198 | } | 3198 | } |
3199 | applet++; | 3199 | applet++; |
@@ -3274,8 +3274,8 @@ static int doumask(struct op *t) | |||
3274 | i = umask(0); | 3274 | i = umask(0); |
3275 | umask(i); | 3275 | umask(i); |
3276 | for (n = 3 * 4; (n -= 3) >= 0;) | 3276 | for (n = 3 * 4; (n -= 3) >= 0;) |
3277 | putc('0' + ((i >> n) & 07), stderr); | 3277 | fputc('0' + ((i >> n) & 07), stderr); |
3278 | putc('\n', stderr); | 3278 | fputc('\n', stderr); |
3279 | } else { | 3279 | } else { |
3280 | /* huh??? '8','9' are not allowed! */ | 3280 | /* huh??? '8','9' are not allowed! */ |
3281 | for (n = 0; *cp >= '0' && *cp <= '9'; cp++) | 3281 | for (n = 0; *cp >= '0' && *cp <= '9'; cp++) |
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 909cbd24e..3aa99e58f 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c | |||
@@ -38,12 +38,12 @@ int dmesg_main(int argc, char **argv) | |||
38 | 38 | ||
39 | for (in = 0; in<len;) { | 39 | for (in = 0; in<len;) { |
40 | if (last == '\n' && buf[in] == '<') in += 3; | 40 | if (last == '\n' && buf[in] == '<') in += 3; |
41 | else putchar(last = buf[in++]); | 41 | else bb_putchar(last = buf[in++]); |
42 | } | 42 | } |
43 | if (last != '\n') putchar('\n'); | 43 | if (last != '\n') bb_putchar('\n'); |
44 | } else { | 44 | } else { |
45 | write(1,buf,len); | 45 | write(1,buf,len); |
46 | if (len && buf[len-1]!='\n') putchar('\n'); | 46 | if (len && buf[len-1]!='\n') bb_putchar('\n'); |
47 | } | 47 | } |
48 | 48 | ||
49 | if (ENABLE_FEATURE_CLEAN_UP) free(buf); | 49 | if (ENABLE_FEATURE_CLEAN_UP) free(buf); |
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 7981abc9f..9f30571e9 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
@@ -892,7 +892,7 @@ list_types(const char *const *sys) | |||
892 | next = ++done; | 892 | next = ++done; |
893 | } | 893 | } |
894 | } while (done < last[0]); | 894 | } while (done < last[0]); |
895 | putchar('\n'); | 895 | bb_putchar('\n'); |
896 | } | 896 | } |
897 | #endif /* FEATURE_FDISK_WRITABLE */ | 897 | #endif /* FEATURE_FDISK_WRITABLE */ |
898 | 898 | ||
@@ -2473,13 +2473,13 @@ print_buffer(char *pbuffer) | |||
2473 | printf("0x%03X:", i); | 2473 | printf("0x%03X:", i); |
2474 | printf(" %02X", (unsigned char) pbuffer[i]); | 2474 | printf(" %02X", (unsigned char) pbuffer[i]); |
2475 | if (l == MAX_PER_LINE - 1) { | 2475 | if (l == MAX_PER_LINE - 1) { |
2476 | puts(""); | 2476 | bb_putchar('\n'); |
2477 | l = -1; | 2477 | l = -1; |
2478 | } | 2478 | } |
2479 | } | 2479 | } |
2480 | if (l > 0) | 2480 | if (l > 0) |
2481 | puts(""); | 2481 | bb_putchar('\n'); |
2482 | puts(""); | 2482 | bb_putchar('\n'); |
2483 | } | 2483 | } |
2484 | 2484 | ||
2485 | static void | 2485 | static void |
@@ -2527,7 +2527,7 @@ xselect(void) | |||
2527 | char c; | 2527 | char c; |
2528 | 2528 | ||
2529 | while (1) { | 2529 | while (1) { |
2530 | putchar('\n'); | 2530 | bb_putchar('\n'); |
2531 | c = tolower(read_nonempty("Expert command (m for help): ")); | 2531 | c = tolower(read_nonempty("Expert command (m for help): ")); |
2532 | switch (c) { | 2532 | switch (c) { |
2533 | case 'a': | 2533 | case 'a': |
@@ -2588,7 +2588,7 @@ xselect(void) | |||
2588 | break; | 2588 | break; |
2589 | case 'q': | 2589 | case 'q': |
2590 | close(fd); | 2590 | close(fd); |
2591 | puts(""); | 2591 | bb_putchar('\n'); |
2592 | exit(0); | 2592 | exit(0); |
2593 | case 'r': | 2593 | case 'r': |
2594 | return; | 2594 | return; |
@@ -2867,7 +2867,7 @@ int fdisk_main(int argc, char **argv) | |||
2867 | 2867 | ||
2868 | while (1) { | 2868 | while (1) { |
2869 | int c; | 2869 | int c; |
2870 | putchar('\n'); | 2870 | bb_putchar('\n'); |
2871 | c = tolower(read_nonempty("Command (m for help): ")); | 2871 | c = tolower(read_nonempty("Command (m for help): ")); |
2872 | switch (c) { | 2872 | switch (c) { |
2873 | case 'a': | 2873 | case 'a': |
@@ -2947,7 +2947,7 @@ int fdisk_main(int argc, char **argv) | |||
2947 | break; | 2947 | break; |
2948 | case 'q': | 2948 | case 'q': |
2949 | close(fd); | 2949 | close(fd); |
2950 | puts(""); | 2950 | bb_putchar('\n'); |
2951 | return 0; | 2951 | return 0; |
2952 | case 's': | 2952 | case 's': |
2953 | #if ENABLE_FEATURE_SUN_LABEL | 2953 | #if ENABLE_FEATURE_SUN_LABEL |
diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c index f6486d5f9..726138265 100644 --- a/util-linux/fdisk_osf.c +++ b/util-linux/fdisk_osf.c | |||
@@ -394,7 +394,7 @@ bsd_select(void) | |||
394 | #endif | 394 | #endif |
395 | 395 | ||
396 | while (1) { | 396 | while (1) { |
397 | putchar('\n'); | 397 | bb_putchar('\n'); |
398 | switch (tolower(read_nonempty("BSD disklabel command (m for help): "))) { | 398 | switch (tolower(read_nonempty("BSD disklabel command (m for help): "))) { |
399 | case 'd': | 399 | case 'd': |
400 | xbsd_delete_part(); | 400 | xbsd_delete_part(); |
@@ -521,7 +521,7 @@ xbsd_print_disklabel(int show_all) | |||
521 | printf(" ecc"); | 521 | printf(" ecc"); |
522 | if (lp->d_flags & BSD_D_BADSECT) | 522 | if (lp->d_flags & BSD_D_BADSECT) |
523 | printf(" badsect"); | 523 | printf(" badsect"); |
524 | puts(""); | 524 | bb_putchar('\n'); |
525 | /* On various machines the fields of *lp are short/int/long */ | 525 | /* On various machines the fields of *lp are short/int/long */ |
526 | /* In order to avoid problems, we cast them all to long. */ | 526 | /* In order to avoid problems, we cast them all to long. */ |
527 | printf("bytes/sector: %ld\n", (long) lp->d_secsize); | 527 | printf("bytes/sector: %ld\n", (long) lp->d_secsize); |
@@ -588,7 +588,7 @@ xbsd_print_disklabel(int show_all) | |||
588 | printf("%22.22s", ""); | 588 | printf("%22.22s", ""); |
589 | break; | 589 | break; |
590 | } | 590 | } |
591 | puts(""); | 591 | bb_putchar('\n'); |
592 | } | 592 | } |
593 | } | 593 | } |
594 | } | 594 | } |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 531c1ea0b..5f92f3511 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -307,12 +307,12 @@ static int ask(const char *string, int def) | |||
307 | int c; | 307 | int c; |
308 | 308 | ||
309 | if (!repair) { | 309 | if (!repair) { |
310 | puts(""); | 310 | bb_putchar('\n'); |
311 | errors_uncorrected = 1; | 311 | errors_uncorrected = 1; |
312 | return 0; | 312 | return 0; |
313 | } | 313 | } |
314 | if (automatic) { | 314 | if (automatic) { |
315 | puts(""); | 315 | bb_putchar('\n'); |
316 | if (!def) | 316 | if (!def) |
317 | errors_uncorrected = 1; | 317 | errors_uncorrected = 1; |
318 | return def; | 318 | return def; |
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 94fb45761..4767d586c 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c | |||
@@ -195,7 +195,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru | |||
195 | printf(" --"); | 195 | printf(" --"); |
196 | while (optind < argc) | 196 | while (optind < argc) |
197 | printf(" %s", normalize(argv[optind++])); | 197 | printf(" %s", normalize(argv[optind++])); |
198 | puts(""); | 198 | bb_putchar('\n'); |
199 | } | 199 | } |
200 | return exit_code; | 200 | return exit_code; |
201 | } | 201 | } |
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index 0b4dbf643..d5325902b 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c | |||
@@ -555,7 +555,7 @@ static void print_sem(int semid) | |||
555 | } | 555 | } |
556 | printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid); | 556 | printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid); |
557 | } | 557 | } |
558 | puts(""); | 558 | bb_putchar('\n'); |
559 | } | 559 | } |
560 | 560 | ||
561 | int ipcs_main(int argc, char **argv); | 561 | int ipcs_main(int argc, char **argv); |
@@ -603,19 +603,19 @@ int ipcs_main(int argc, char **argv) | |||
603 | 603 | ||
604 | if (!(flags & (flag_shm | flag_msg | flag_sem))) | 604 | if (!(flags & (flag_shm | flag_msg | flag_sem))) |
605 | flags |= flag_msg | flag_shm | flag_sem; | 605 | flags |= flag_msg | flag_shm | flag_sem; |
606 | puts(""); | 606 | bb_putchar('\n'); |
607 | 607 | ||
608 | if (flags & flag_shm) { | 608 | if (flags & flag_shm) { |
609 | do_shm(); | 609 | do_shm(); |
610 | puts(""); | 610 | bb_putchar('\n'); |
611 | } | 611 | } |
612 | if (flags & flag_sem) { | 612 | if (flags & flag_sem) { |
613 | do_sem(); | 613 | do_sem(); |
614 | puts(""); | 614 | bb_putchar('\n'); |
615 | } | 615 | } |
616 | if (flags & flag_msg) { | 616 | if (flags & flag_msg) { |
617 | do_msg(); | 617 | do_msg(); |
618 | puts(""); | 618 | bb_putchar('\n'); |
619 | } | 619 | } |
620 | fflush_stdout_and_exit(0); | 620 | fflush_stdout_and_exit(0); |
621 | } | 621 | } |
diff --git a/util-linux/more.c b/util-linux/more.c index dc5b4c99e..0a21a9afa 100644 --- a/util-linux/more.c +++ b/util-linux/more.c | |||
@@ -40,7 +40,7 @@ struct globals { | |||
40 | 40 | ||
41 | static void gotsig(int sig) | 41 | static void gotsig(int sig) |
42 | { | 42 | { |
43 | putchar('\n'); | 43 | bb_putchar('\n'); |
44 | setTermSettings(cin_fileno, &initial_settings); | 44 | setTermSettings(cin_fileno, &initial_settings); |
45 | exit(EXIT_FAILURE); | 45 | exit(EXIT_FAILURE); |
46 | } | 46 | } |