diff options
| author | Ron Yorston <rmy@pobox.com> | 2021-02-03 20:47:14 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-02-03 20:52:40 +0100 |
| commit | cad3fc743aa7c7744e4fcf044371f0fda50fa51f (patch) | |
| tree | 30b1de29e61ed3b5975d183b1746516b7abdc88f /coreutils | |
| parent | 6ad38d66d08a2646c6423b967a790656ae026c95 (diff) | |
| download | busybox-w32-cad3fc743aa7c7744e4fcf044371f0fda50fa51f.tar.gz busybox-w32-cad3fc743aa7c7744e4fcf044371f0fda50fa51f.tar.bz2 busybox-w32-cad3fc743aa7c7744e4fcf044371f0fda50fa51f.zip | |
libbb: introduce and use fputs_stdout
function old new delta
fputs_stdout - 12 +12
zxc_vm_process 7237 7230 -7
yes_main 85 78 -7
write_block 380 373 -7
wrapf 305 298 -7
strings_main 437 430 -7
show_bridge 353 346 -7
rev_main 384 377 -7
put_prompt_custom 58 51 -7
put_cur_glyph_and_inc_cursor 168 161 -7
print_numbered_lines 152 145 -7
print_named_ascii 130 123 -7
print_name 135 128 -7
print_login_issue 386 379 -7
print_ascii 208 201 -7
powertop_main 1249 1242 -7
od_main 1789 1782 -7
logread_main 518 511 -7
head_main 804 797 -7
display_process_list 1319 1312 -7
cut_main 1002 995 -7
bb_dump_dump 1550 1543 -7
bb_ask_noecho 393 386 -7
baseNUM_main 702 695 -7
expand_main 755 745 -10
dumpleases_main 497 487 -10
write1 12 - -12
putcsi 37 23 -14
print_login_prompt 55 41 -14
paste_main 525 511 -14
cat_main 440 426 -14
print_it 245 230 -15
print_addrinfo 1188 1171 -17
print_rule 770 750 -20
print_linkinfo 842 822 -20
httpd_main 791 771 -20
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/34 up/down: 12/-341) Total: -329 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/cat.c | 2 | ||||
| -rw-r--r-- | coreutils/cut.c | 2 | ||||
| -rw-r--r-- | coreutils/expand.c | 2 | ||||
| -rw-r--r-- | coreutils/head.c | 2 | ||||
| -rw-r--r-- | coreutils/id.c | 2 | ||||
| -rw-r--r-- | coreutils/ls.c | 2 | ||||
| -rw-r--r-- | coreutils/od_bloaty.c | 26 | ||||
| -rw-r--r-- | coreutils/paste.c | 4 | ||||
| -rw-r--r-- | coreutils/stat.c | 2 | ||||
| -rw-r--r-- | coreutils/stty.c | 2 | ||||
| -rw-r--r-- | coreutils/uudecode.c | 2 | ||||
| -rw-r--r-- | coreutils/yes.c | 2 |
12 files changed, 25 insertions, 25 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c index dae6089bd..4b3414941 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c | |||
| @@ -152,7 +152,7 @@ static int catv(unsigned opts, char **argv) | |||
| 152 | eol_seen = (c == eol_char); | 152 | eol_seen = (c == eol_char); |
| 153 | #endif | 153 | #endif |
| 154 | visible(c, buf, opts); | 154 | visible(c, buf, opts); |
| 155 | fputs(buf, stdout); | 155 | fputs_stdout(buf); |
| 156 | } | 156 | } |
| 157 | } | 157 | } |
| 158 | if (ENABLE_FEATURE_CLEAN_UP && fd) | 158 | if (ENABLE_FEATURE_CLEAN_UP && fd) |
diff --git a/coreutils/cut.c b/coreutils/cut.c index 1acbb513e..16418ff33 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
| @@ -167,7 +167,7 @@ static void cut_file(FILE *file, char delim, const struct cut_list *cut_lists, u | |||
| 167 | * printed */ | 167 | * printed */ |
| 168 | if (nfields_printed > 0) | 168 | if (nfields_printed > 0) |
| 169 | putchar(delim); | 169 | putchar(delim); |
| 170 | fputs(field, stdout); | 170 | fputs_stdout(field); |
| 171 | printed[ndelim] = 'X'; | 171 | printed[ndelim] = 'X'; |
| 172 | nfields_printed++; /* shouldn't overflow.. */ | 172 | nfields_printed++; /* shouldn't overflow.. */ |
| 173 | } | 173 | } |
diff --git a/coreutils/expand.c b/coreutils/expand.c index 5f5993921..c5e1de6f5 100644 --- a/coreutils/expand.c +++ b/coreutils/expand.c | |||
| @@ -123,7 +123,7 @@ static void expand(FILE *file, unsigned tab_size, unsigned opt) | |||
| 123 | } | 123 | } |
| 124 | ptr++; | 124 | ptr++; |
| 125 | } | 125 | } |
| 126 | fputs(ptr_strbeg, stdout); | 126 | fputs_stdout(ptr_strbeg); |
| 127 | free(line); | 127 | free(line); |
| 128 | } | 128 | } |
| 129 | } | 129 | } |
diff --git a/coreutils/head.c b/coreutils/head.c index 1219dfe8b..b6efabbe0 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
| @@ -117,7 +117,7 @@ print_except_N_last_lines(FILE *fp, unsigned count) | |||
| 117 | char *c; | 117 | char *c; |
| 118 | if (head == count) | 118 | if (head == count) |
| 119 | head = 0; | 119 | head = 0; |
| 120 | fputs(circle[head], stdout); | 120 | fputs_stdout(circle[head]); |
| 121 | c = xmalloc_fgets(fp); | 121 | c = xmalloc_fgets(fp); |
| 122 | if (!c) | 122 | if (!c) |
| 123 | goto ret; | 123 | goto ret; |
diff --git a/coreutils/id.c b/coreutils/id.c index 78d5f2a50..f453a87ae 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
| @@ -258,7 +258,7 @@ int id_main(int argc UNUSED_PARAM, char **argv) | |||
| 258 | bb_error_msg_and_die("can't get process context%s", | 258 | bb_error_msg_and_die("can't get process context%s", |
| 259 | username ? " for a different user" : ""); | 259 | username ? " for a different user" : ""); |
| 260 | } | 260 | } |
| 261 | fputs(scontext, stdout); | 261 | fputs_stdout(scontext); |
| 262 | } | 262 | } |
| 263 | /* freecon(NULL) seems to be harmless */ | 263 | /* freecon(NULL) seems to be harmless */ |
| 264 | if (ENABLE_FEATURE_CLEAN_UP) | 264 | if (ENABLE_FEATURE_CLEAN_UP) |
diff --git a/coreutils/ls.c b/coreutils/ls.c index e5375a61a..80ef92079 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
| @@ -453,7 +453,7 @@ static unsigned print_name(const char *name) | |||
| 453 | name = printable_string2(&uni_stat, name); | 453 | name = printable_string2(&uni_stat, name); |
| 454 | 454 | ||
| 455 | if (!(option_mask32 & OPT_Q)) { | 455 | if (!(option_mask32 & OPT_Q)) { |
| 456 | fputs(name, stdout); | 456 | fputs_stdout(name); |
| 457 | return uni_stat.unicode_width; | 457 | return uni_stat.unicode_width; |
| 458 | } | 458 | } |
| 459 | 459 | ||
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index d5bd7bfe8..5b5e56a21 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
| @@ -422,19 +422,19 @@ print_named_ascii(size_t n_bytes, const char *block, | |||
| 422 | 422 | ||
| 423 | masked_c &= 0x7f; | 423 | masked_c &= 0x7f; |
| 424 | if (masked_c == 0x7f) { | 424 | if (masked_c == 0x7f) { |
| 425 | fputs(" del", stdout); | 425 | fputs_stdout(" del"); |
| 426 | continue; | 426 | continue; |
| 427 | } | 427 | } |
| 428 | if (masked_c > ' ') { | 428 | if (masked_c > ' ') { |
| 429 | buf[3] = masked_c; | 429 | buf[3] = masked_c; |
| 430 | fputs(buf, stdout); | 430 | fputs_stdout(buf); |
| 431 | continue; | 431 | continue; |
| 432 | } | 432 | } |
| 433 | /* Why? Because printf(" %3.3s") is much slower... */ | 433 | /* Why? Because printf(" %3.3s") is much slower... */ |
| 434 | buf[6] = charname[masked_c][0]; | 434 | buf[6] = charname[masked_c][0]; |
| 435 | buf[7] = charname[masked_c][1]; | 435 | buf[7] = charname[masked_c][1]; |
| 436 | buf[8] = charname[masked_c][2]; | 436 | buf[8] = charname[masked_c][2]; |
| 437 | fputs(buf+5, stdout); | 437 | fputs_stdout(buf+5); |
| 438 | } | 438 | } |
| 439 | } | 439 | } |
| 440 | 440 | ||
| @@ -451,7 +451,7 @@ print_ascii(size_t n_bytes, const char *block, | |||
| 451 | 451 | ||
| 452 | if (ISPRINT(c)) { | 452 | if (ISPRINT(c)) { |
| 453 | buf[3] = c; | 453 | buf[3] = c; |
| 454 | fputs(buf, stdout); | 454 | fputs_stdout(buf); |
| 455 | continue; | 455 | continue; |
| 456 | } | 456 | } |
| 457 | switch (c) { | 457 | switch (c) { |
| @@ -485,7 +485,7 @@ print_ascii(size_t n_bytes, const char *block, | |||
| 485 | buf[8] = (c & 7) + '0'; | 485 | buf[8] = (c & 7) + '0'; |
| 486 | s = buf + 5; | 486 | s = buf + 5; |
| 487 | } | 487 | } |
| 488 | fputs(s, stdout); | 488 | fputs_stdout(s); |
| 489 | } | 489 | } |
| 490 | } | 490 | } |
| 491 | 491 | ||
| @@ -881,7 +881,7 @@ format_address_label(off_t address, char c) | |||
| 881 | static void | 881 | static void |
| 882 | dump_hexl_mode_trailer(size_t n_bytes, const char *block) | 882 | dump_hexl_mode_trailer(size_t n_bytes, const char *block) |
| 883 | { | 883 | { |
| 884 | fputs(" >", stdout); | 884 | fputs_stdout(" >"); |
| 885 | while (n_bytes--) { | 885 | while (n_bytes--) { |
| 886 | unsigned c = *(unsigned char *) block++; | 886 | unsigned c = *(unsigned char *) block++; |
| 887 | c = (ISPRINT(c) ? c : '.'); | 887 | c = (ISPRINT(c) ? c : '.'); |
| @@ -1121,13 +1121,13 @@ dump_strings(off_t address, off_t end_offset) | |||
| 1121 | 1121 | ||
| 1122 | for (i = 0; (c = buf[i]); i++) { | 1122 | for (i = 0; (c = buf[i]); i++) { |
| 1123 | switch (c) { | 1123 | switch (c) { |
| 1124 | case '\007': fputs("\\a", stdout); break; | 1124 | case '\007': fputs_stdout("\\a"); break; |
| 1125 | case '\b': fputs("\\b", stdout); break; | 1125 | case '\b': fputs_stdout("\\b"); break; |
| 1126 | case '\f': fputs("\\f", stdout); break; | 1126 | case '\f': fputs_stdout("\\f"); break; |
| 1127 | case '\n': fputs("\\n", stdout); break; | 1127 | case '\n': fputs_stdout("\\n"); break; |
| 1128 | case '\r': fputs("\\r", stdout); break; | 1128 | case '\r': fputs_stdout("\\r"); break; |
| 1129 | case '\t': fputs("\\t", stdout); break; | 1129 | case '\t': fputs_stdout("\\t"); break; |
| 1130 | case '\v': fputs("\\v", stdout); break; | 1130 | case '\v': fputs_stdout("\\v"); break; |
| 1131 | default: putchar(c); | 1131 | default: putchar(c); |
| 1132 | } | 1132 | } |
| 1133 | } | 1133 | } |
diff --git a/coreutils/paste.c b/coreutils/paste.c index fd2aa5027..7def4de11 100644 --- a/coreutils/paste.c +++ b/coreutils/paste.c | |||
| @@ -53,7 +53,7 @@ static void paste_files(FILE** files, int file_cnt, char* delims, int del_cnt) | |||
| 53 | --active_files; | 53 | --active_files; |
| 54 | continue; | 54 | continue; |
| 55 | } | 55 | } |
| 56 | fputs(line, stdout); | 56 | fputs_stdout(line); |
| 57 | free(line); | 57 | free(line); |
| 58 | delim = '\n'; | 58 | delim = '\n'; |
| 59 | if (i != file_cnt - 1) { | 59 | if (i != file_cnt - 1) { |
| @@ -79,7 +79,7 @@ static void paste_files_separate(FILE** files, char* delims, int del_cnt) | |||
| 79 | line = NULL; | 79 | line = NULL; |
| 80 | while ((next_line = xmalloc_fgetline(files[i])) != NULL) { | 80 | while ((next_line = xmalloc_fgetline(files[i])) != NULL) { |
| 81 | if (line) { | 81 | if (line) { |
| 82 | fputs(line, stdout); | 82 | fputs_stdout(line); |
| 83 | free(line); | 83 | free(line); |
| 84 | delim = delims[del_idx++]; | 84 | delim = delims[del_idx++]; |
| 85 | if (del_idx == del_cnt) | 85 | if (del_idx == del_cnt) |
diff --git a/coreutils/stat.c b/coreutils/stat.c index 073b2c67b..a8393468e 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
| @@ -439,7 +439,7 @@ static void print_it(const char *masterformat, | |||
| 439 | 439 | ||
| 440 | /* print preceding string */ | 440 | /* print preceding string */ |
| 441 | *p = '\0'; | 441 | *p = '\0'; |
| 442 | fputs(b, stdout); | 442 | fputs_stdout(b); |
| 443 | 443 | ||
| 444 | p += len; | 444 | p += len; |
| 445 | b = p + 1; | 445 | b = p + 1; |
diff --git a/coreutils/stty.c b/coreutils/stty.c index 19253964c..ba2b78317 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
| @@ -855,7 +855,7 @@ static void wrapf(const char *message, ...) | |||
| 855 | } | 855 | } |
| 856 | } | 856 | } |
| 857 | } | 857 | } |
| 858 | fputs(buf, stdout); | 858 | fputs_stdout(buf); |
| 859 | G.current_col += buflen; | 859 | G.current_col += buflen; |
| 860 | if (buf[buflen-1] == '\n') | 860 | if (buf[buflen-1] == '\n') |
| 861 | G.current_col = 0; | 861 | G.current_col = 0; |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 164b208ea..02b037276 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
| @@ -319,7 +319,7 @@ int baseNUM_main(int argc UNUSED_PARAM, char **argv) | |||
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | if (col == 0) { | 321 | if (col == 0) { |
| 322 | fputs(dst_buf, stdout); | 322 | fputs_stdout(dst_buf); |
| 323 | } else { | 323 | } else { |
| 324 | char *result = dst_buf; | 324 | char *result = dst_buf; |
| 325 | if (rem == 0) | 325 | if (rem == 0) |
diff --git a/coreutils/yes.c b/coreutils/yes.c index 9a435a761..0ad25926f 100644 --- a/coreutils/yes.c +++ b/coreutils/yes.c | |||
| @@ -43,7 +43,7 @@ int yes_main(int argc UNUSED_PARAM, char **argv) | |||
| 43 | do { | 43 | do { |
| 44 | pp = argv; | 44 | pp = argv; |
| 45 | while (1) { | 45 | while (1) { |
| 46 | fputs(*pp, stdout); | 46 | fputs_stdout(*pp); |
| 47 | if (!*++pp) | 47 | if (!*++pp) |
| 48 | break; | 48 | break; |
| 49 | putchar(' '); | 49 | putchar(' '); |
