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>
This commit is contained in:
parent
6ad38d66d0
commit
cad3fc743a
@ -19,6 +19,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
void bb_show_usage(void)
|
void bb_show_usage(void)
|
||||||
{
|
{
|
||||||
fputs(APPLET_full_usage "\n", stdout);
|
fputs_stdout(APPLET_full_usage "\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ static int catv(unsigned opts, char **argv)
|
|||||||
eol_seen = (c == eol_char);
|
eol_seen = (c == eol_char);
|
||||||
#endif
|
#endif
|
||||||
visible(c, buf, opts);
|
visible(c, buf, opts);
|
||||||
fputs(buf, stdout);
|
fputs_stdout(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ENABLE_FEATURE_CLEAN_UP && fd)
|
if (ENABLE_FEATURE_CLEAN_UP && fd)
|
||||||
|
@ -167,7 +167,7 @@ static void cut_file(FILE *file, char delim, const struct cut_list *cut_lists, u
|
|||||||
* printed */
|
* printed */
|
||||||
if (nfields_printed > 0)
|
if (nfields_printed > 0)
|
||||||
putchar(delim);
|
putchar(delim);
|
||||||
fputs(field, stdout);
|
fputs_stdout(field);
|
||||||
printed[ndelim] = 'X';
|
printed[ndelim] = 'X';
|
||||||
nfields_printed++; /* shouldn't overflow.. */
|
nfields_printed++; /* shouldn't overflow.. */
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ static void expand(FILE *file, unsigned tab_size, unsigned opt)
|
|||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
fputs(ptr_strbeg, stdout);
|
fputs_stdout(ptr_strbeg);
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ print_except_N_last_lines(FILE *fp, unsigned count)
|
|||||||
char *c;
|
char *c;
|
||||||
if (head == count)
|
if (head == count)
|
||||||
head = 0;
|
head = 0;
|
||||||
fputs(circle[head], stdout);
|
fputs_stdout(circle[head]);
|
||||||
c = xmalloc_fgets(fp);
|
c = xmalloc_fgets(fp);
|
||||||
if (!c)
|
if (!c)
|
||||||
goto ret;
|
goto ret;
|
||||||
|
@ -258,7 +258,7 @@ int id_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
bb_error_msg_and_die("can't get process context%s",
|
bb_error_msg_and_die("can't get process context%s",
|
||||||
username ? " for a different user" : "");
|
username ? " for a different user" : "");
|
||||||
}
|
}
|
||||||
fputs(scontext, stdout);
|
fputs_stdout(scontext);
|
||||||
}
|
}
|
||||||
/* freecon(NULL) seems to be harmless */
|
/* freecon(NULL) seems to be harmless */
|
||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
|
@ -453,7 +453,7 @@ static unsigned print_name(const char *name)
|
|||||||
name = printable_string2(&uni_stat, name);
|
name = printable_string2(&uni_stat, name);
|
||||||
|
|
||||||
if (!(option_mask32 & OPT_Q)) {
|
if (!(option_mask32 & OPT_Q)) {
|
||||||
fputs(name, stdout);
|
fputs_stdout(name);
|
||||||
return uni_stat.unicode_width;
|
return uni_stat.unicode_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,19 +422,19 @@ print_named_ascii(size_t n_bytes, const char *block,
|
|||||||
|
|
||||||
masked_c &= 0x7f;
|
masked_c &= 0x7f;
|
||||||
if (masked_c == 0x7f) {
|
if (masked_c == 0x7f) {
|
||||||
fputs(" del", stdout);
|
fputs_stdout(" del");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (masked_c > ' ') {
|
if (masked_c > ' ') {
|
||||||
buf[3] = masked_c;
|
buf[3] = masked_c;
|
||||||
fputs(buf, stdout);
|
fputs_stdout(buf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* Why? Because printf(" %3.3s") is much slower... */
|
/* Why? Because printf(" %3.3s") is much slower... */
|
||||||
buf[6] = charname[masked_c][0];
|
buf[6] = charname[masked_c][0];
|
||||||
buf[7] = charname[masked_c][1];
|
buf[7] = charname[masked_c][1];
|
||||||
buf[8] = charname[masked_c][2];
|
buf[8] = charname[masked_c][2];
|
||||||
fputs(buf+5, stdout);
|
fputs_stdout(buf+5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ print_ascii(size_t n_bytes, const char *block,
|
|||||||
|
|
||||||
if (ISPRINT(c)) {
|
if (ISPRINT(c)) {
|
||||||
buf[3] = c;
|
buf[3] = c;
|
||||||
fputs(buf, stdout);
|
fputs_stdout(buf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@ -485,7 +485,7 @@ print_ascii(size_t n_bytes, const char *block,
|
|||||||
buf[8] = (c & 7) + '0';
|
buf[8] = (c & 7) + '0';
|
||||||
s = buf + 5;
|
s = buf + 5;
|
||||||
}
|
}
|
||||||
fputs(s, stdout);
|
fputs_stdout(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -881,7 +881,7 @@ format_address_label(off_t address, char c)
|
|||||||
static void
|
static void
|
||||||
dump_hexl_mode_trailer(size_t n_bytes, const char *block)
|
dump_hexl_mode_trailer(size_t n_bytes, const char *block)
|
||||||
{
|
{
|
||||||
fputs(" >", stdout);
|
fputs_stdout(" >");
|
||||||
while (n_bytes--) {
|
while (n_bytes--) {
|
||||||
unsigned c = *(unsigned char *) block++;
|
unsigned c = *(unsigned char *) block++;
|
||||||
c = (ISPRINT(c) ? c : '.');
|
c = (ISPRINT(c) ? c : '.');
|
||||||
@ -1121,13 +1121,13 @@ dump_strings(off_t address, off_t end_offset)
|
|||||||
|
|
||||||
for (i = 0; (c = buf[i]); i++) {
|
for (i = 0; (c = buf[i]); i++) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '\007': fputs("\\a", stdout); break;
|
case '\007': fputs_stdout("\\a"); break;
|
||||||
case '\b': fputs("\\b", stdout); break;
|
case '\b': fputs_stdout("\\b"); break;
|
||||||
case '\f': fputs("\\f", stdout); break;
|
case '\f': fputs_stdout("\\f"); break;
|
||||||
case '\n': fputs("\\n", stdout); break;
|
case '\n': fputs_stdout("\\n"); break;
|
||||||
case '\r': fputs("\\r", stdout); break;
|
case '\r': fputs_stdout("\\r"); break;
|
||||||
case '\t': fputs("\\t", stdout); break;
|
case '\t': fputs_stdout("\\t"); break;
|
||||||
case '\v': fputs("\\v", stdout); break;
|
case '\v': fputs_stdout("\\v"); break;
|
||||||
default: putchar(c);
|
default: putchar(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ static void paste_files(FILE** files, int file_cnt, char* delims, int del_cnt)
|
|||||||
--active_files;
|
--active_files;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fputs(line, stdout);
|
fputs_stdout(line);
|
||||||
free(line);
|
free(line);
|
||||||
delim = '\n';
|
delim = '\n';
|
||||||
if (i != file_cnt - 1) {
|
if (i != file_cnt - 1) {
|
||||||
@ -79,7 +79,7 @@ static void paste_files_separate(FILE** files, char* delims, int del_cnt)
|
|||||||
line = NULL;
|
line = NULL;
|
||||||
while ((next_line = xmalloc_fgetline(files[i])) != NULL) {
|
while ((next_line = xmalloc_fgetline(files[i])) != NULL) {
|
||||||
if (line) {
|
if (line) {
|
||||||
fputs(line, stdout);
|
fputs_stdout(line);
|
||||||
free(line);
|
free(line);
|
||||||
delim = delims[del_idx++];
|
delim = delims[del_idx++];
|
||||||
if (del_idx == del_cnt)
|
if (del_idx == del_cnt)
|
||||||
|
@ -439,7 +439,7 @@ static void print_it(const char *masterformat,
|
|||||||
|
|
||||||
/* print preceding string */
|
/* print preceding string */
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
fputs(b, stdout);
|
fputs_stdout(b);
|
||||||
|
|
||||||
p += len;
|
p += len;
|
||||||
b = p + 1;
|
b = p + 1;
|
||||||
|
@ -855,7 +855,7 @@ static void wrapf(const char *message, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fputs(buf, stdout);
|
fputs_stdout(buf);
|
||||||
G.current_col += buflen;
|
G.current_col += buflen;
|
||||||
if (buf[buflen-1] == '\n')
|
if (buf[buflen-1] == '\n')
|
||||||
G.current_col = 0;
|
G.current_col = 0;
|
||||||
|
@ -319,7 +319,7 @@ int baseNUM_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (col == 0) {
|
if (col == 0) {
|
||||||
fputs(dst_buf, stdout);
|
fputs_stdout(dst_buf);
|
||||||
} else {
|
} else {
|
||||||
char *result = dst_buf;
|
char *result = dst_buf;
|
||||||
if (rem == 0)
|
if (rem == 0)
|
||||||
|
@ -43,7 +43,7 @@ int yes_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
do {
|
do {
|
||||||
pp = argv;
|
pp = argv;
|
||||||
while (1) {
|
while (1) {
|
||||||
fputs(*pp, stdout);
|
fputs_stdout(*pp);
|
||||||
if (!*++pp)
|
if (!*++pp)
|
||||||
break;
|
break;
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
|
@ -553,7 +553,7 @@ static int printLines(int num1, int num2, int expandFlag)
|
|||||||
fputc_printable(ch | PRINTABLE_META, stdout);
|
fputc_printable(ch | PRINTABLE_META, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs("$\n", stdout);
|
fputs_stdout("$\n");
|
||||||
|
|
||||||
setCurNum(num1++);
|
setCurNum(num1++);
|
||||||
lp = lp->next;
|
lp = lp->next;
|
||||||
|
@ -522,7 +522,7 @@ static void show_help(void)
|
|||||||
|
|
||||||
static void write1(const char *out)
|
static void write1(const char *out)
|
||||||
{
|
{
|
||||||
fputs(out, stdout);
|
fputs_stdout(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_FEATURE_VI_WIN_RESIZE
|
#if ENABLE_FEATURE_VI_WIN_RESIZE
|
||||||
|
@ -874,6 +874,7 @@ char *xmalloc_substitute_string(const char *src, int count, const char *sub, con
|
|||||||
int bb_putchar(int ch) FAST_FUNC;
|
int bb_putchar(int ch) FAST_FUNC;
|
||||||
/* Note: does not use stdio, writes to fd 2 directly */
|
/* Note: does not use stdio, writes to fd 2 directly */
|
||||||
int bb_putchar_stderr(char ch) FAST_FUNC;
|
int bb_putchar_stderr(char ch) FAST_FUNC;
|
||||||
|
int fputs_stdout(const char *s) FAST_FUNC;
|
||||||
char *xasprintf(const char *format, ...) __attribute__ ((format(printf, 1, 2))) FAST_FUNC RETURNS_MALLOC;
|
char *xasprintf(const char *format, ...) __attribute__ ((format(printf, 1, 2))) FAST_FUNC RETURNS_MALLOC;
|
||||||
char *auto_string(char *str) FAST_FUNC;
|
char *auto_string(char *str) FAST_FUNC;
|
||||||
// gcc-4.1.1 still isn't good enough at optimizing it
|
// gcc-4.1.1 still isn't good enough at optimizing it
|
||||||
|
@ -25,7 +25,7 @@ char* FAST_FUNC bb_ask_noecho(int fd, int timeout, const char *prompt)
|
|||||||
/* Was buggy: was printing prompt *before* flushing input,
|
/* Was buggy: was printing prompt *before* flushing input,
|
||||||
* which was upsetting "expect" based scripts of some users.
|
* which was upsetting "expect" based scripts of some users.
|
||||||
*/
|
*/
|
||||||
fputs(prompt, stdout);
|
fputs_stdout(prompt);
|
||||||
fflush_all();
|
fflush_all();
|
||||||
|
|
||||||
tcgetattr(fd, &oldtio);
|
tcgetattr(fd, &oldtio);
|
||||||
|
@ -560,7 +560,7 @@ static void display(priv_dumper_t* dumper)
|
|||||||
) {
|
) {
|
||||||
if (dumper->pub.eofstring) {
|
if (dumper->pub.eofstring) {
|
||||||
/* xxd support: requested to not pad incomplete blocks */
|
/* xxd support: requested to not pad incomplete blocks */
|
||||||
fputs(dumper->pub.eofstring, stdout);
|
fputs_stdout(dumper->pub.eofstring);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(pr->flags & (F_TEXT | F_BPAD)))
|
if (!(pr->flags & (F_TEXT | F_BPAD)))
|
||||||
|
@ -312,7 +312,7 @@ static void BB_PUTCHAR(wchar_t c)
|
|||||||
ssize_t len = wcrtomb(buf, c, &mbst);
|
ssize_t len = wcrtomb(buf, c, &mbst);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
fputs(buf, stdout);
|
fputs_stdout(buf);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* In this case, c is always one byte */
|
/* In this case, c is always one byte */
|
||||||
@ -460,7 +460,7 @@ static void beep(void)
|
|||||||
*/
|
*/
|
||||||
static void put_prompt_custom(bool is_full)
|
static void put_prompt_custom(bool is_full)
|
||||||
{
|
{
|
||||||
fputs((is_full ? cmdedit_prompt : prompt_last_line), stdout);
|
fputs_stdout((is_full ? cmdedit_prompt : prompt_last_line));
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
cmdedit_y = cmdedit_prmt_len / cmdedit_termw; /* new quasireal y */
|
cmdedit_y = cmdedit_prmt_len / cmdedit_termw; /* new quasireal y */
|
||||||
cmdedit_x = cmdedit_prmt_len % cmdedit_termw;
|
cmdedit_x = cmdedit_prmt_len % cmdedit_termw;
|
||||||
@ -1851,7 +1851,7 @@ static void ask_terminal(void)
|
|||||||
pfd.events = POLLIN;
|
pfd.events = POLLIN;
|
||||||
if (safe_poll(&pfd, 1, 0) == 0) {
|
if (safe_poll(&pfd, 1, 0) == 0) {
|
||||||
S.sent_ESC_br6n = 1;
|
S.sent_ESC_br6n = 1;
|
||||||
fputs(ESC"[6n", stdout);
|
fputs_stdout(ESC"[6n");
|
||||||
fflush_all(); /* make terminal see it ASAP! */
|
fflush_all(); /* make terminal see it ASAP! */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2957,7 +2957,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
|
|||||||
#undef read_line_input
|
#undef read_line_input
|
||||||
int FAST_FUNC read_line_input(const char* prompt, char* command, int maxsize)
|
int FAST_FUNC read_line_input(const char* prompt, char* command, int maxsize)
|
||||||
{
|
{
|
||||||
fputs(prompt, stdout);
|
fputs_stdout(prompt);
|
||||||
fflush_all();
|
fflush_all();
|
||||||
if (!fgets(command, maxsize, stdin))
|
if (!fgets(command, maxsize, stdin))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -120,7 +120,7 @@ void FAST_FUNC print_login_issue(const char *issue_file, const char *tty)
|
|||||||
buf[0] = c;
|
buf[0] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fputs(outbuf, stdout);
|
fputs_stdout(outbuf);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fflush_all();
|
fflush_all();
|
||||||
@ -130,8 +130,8 @@ void FAST_FUNC print_login_prompt(void)
|
|||||||
{
|
{
|
||||||
char *hostname = safe_gethostname();
|
char *hostname = safe_gethostname();
|
||||||
|
|
||||||
fputs(hostname, stdout);
|
fputs_stdout(hostname);
|
||||||
fputs(LOGIN, stdout);
|
fputs_stdout(LOGIN);
|
||||||
fflush_all();
|
fflush_all();
|
||||||
free(hostname);
|
free(hostname);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ int FAST_FUNC print_numbered_lines(struct number_state *ns, const char *filename
|
|||||||
printf("%*u%s", ns->width, N, ns->sep);
|
printf("%*u%s", ns->width, N, ns->sep);
|
||||||
N += ns->inc;
|
N += ns->inc;
|
||||||
} else if (ns->empty_str)
|
} else if (ns->empty_str)
|
||||||
fputs(ns->empty_str, stdout);
|
fputs_stdout(ns->empty_str);
|
||||||
puts(line);
|
puts(line);
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
|
@ -318,6 +318,11 @@ int FAST_FUNC bb_putchar(int ch)
|
|||||||
return putchar(ch);
|
return putchar(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FAST_FUNC fputs_stdout(const char *s)
|
||||||
|
{
|
||||||
|
return fputs(s, stdout);
|
||||||
|
}
|
||||||
|
|
||||||
/* Die with an error message if we can't copy an entire FILE* to stdout,
|
/* Die with an error message if we can't copy an entire FILE* to stdout,
|
||||||
* then close that file. */
|
* then close that file. */
|
||||||
void FAST_FUNC xprint_and_close_file(FILE *file)
|
void FAST_FUNC xprint_and_close_file(FILE *file)
|
||||||
|
@ -6448,7 +6448,7 @@ static BC_STATUS zdc_program_printStream(void)
|
|||||||
char *str;
|
char *str;
|
||||||
idx = (r->t == XC_RESULT_STR) ? r->d.id.idx : n->rdx;
|
idx = (r->t == XC_RESULT_STR) ? r->d.id.idx : n->rdx;
|
||||||
str = *xc_program_str(idx);
|
str = *xc_program_str(idx);
|
||||||
fputs(str, stdout);
|
fputs_stdout(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_STATUS(s);
|
RETURN_STATUS(s);
|
||||||
|
@ -107,8 +107,8 @@ enum {
|
|||||||
|
|
||||||
static void putcsi(const char *s)
|
static void putcsi(const char *s)
|
||||||
{
|
{
|
||||||
fputs(ESC"[", stdout);
|
fputs_stdout(ESC"[");
|
||||||
fputs(s, stdout);
|
fputs_stdout(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clrscr(void)
|
static void clrscr(void)
|
||||||
|
@ -92,7 +92,7 @@ int strings_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
if (option_mask32 & (PRINT_OFFSET | PRINT_RADIX)) {
|
if (option_mask32 & (PRINT_OFFSET | PRINT_RADIX)) {
|
||||||
printf(radix_fmt, offset - n);
|
printf(radix_fmt, offset - n);
|
||||||
}
|
}
|
||||||
fputs(string, stdout);
|
fputs_stdout(string);
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ static int show_bridge(const char *name, int need_hdr)
|
|||||||
else
|
else
|
||||||
if (LONE_CHAR(filedata, '1'))
|
if (LONE_CHAR(filedata, '1'))
|
||||||
strcpy(filedata, "yes");
|
strcpy(filedata, "yes");
|
||||||
fputs(filedata, stdout);
|
fputs_stdout(filedata);
|
||||||
|
|
||||||
/* sfx points past "BR/bridge/", turn it into "BR/brif": */
|
/* sfx points past "BR/bridge/", turn it into "BR/brif": */
|
||||||
sfx[-4] = 'f'; sfx[-3] = '\0';
|
sfx[-4] = 'f'; sfx[-3] = '\0';
|
||||||
|
@ -2788,12 +2788,12 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
, &verbose
|
, &verbose
|
||||||
);
|
);
|
||||||
if (opt & OPT_DECODE_URL) {
|
if (opt & OPT_DECODE_URL) {
|
||||||
fputs(percent_decode_in_place(url_for_decode, /*strict:*/ 0), stdout);
|
fputs_stdout(percent_decode_in_place(url_for_decode, /*strict:*/ 0));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#if ENABLE_FEATURE_HTTPD_ENCODE_URL_STR
|
#if ENABLE_FEATURE_HTTPD_ENCODE_URL_STR
|
||||||
if (opt & OPT_ENCODE_URL) {
|
if (opt & OPT_ENCODE_URL) {
|
||||||
fputs(encodeString(url_for_encode), stdout);
|
fputs_stdout(encodeString(url_for_encode));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -192,20 +192,20 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n)
|
|||||||
printf("%c link/%s ", _SL_, ll_type_n2a(ifi->ifi_type, b1));
|
printf("%c link/%s ", _SL_, ll_type_n2a(ifi->ifi_type, b1));
|
||||||
|
|
||||||
if (tb[IFLA_ADDRESS]) {
|
if (tb[IFLA_ADDRESS]) {
|
||||||
fputs(ll_addr_n2a(RTA_DATA(tb[IFLA_ADDRESS]),
|
fputs_stdout(ll_addr_n2a(RTA_DATA(tb[IFLA_ADDRESS]),
|
||||||
RTA_PAYLOAD(tb[IFLA_ADDRESS]),
|
RTA_PAYLOAD(tb[IFLA_ADDRESS]),
|
||||||
ifi->ifi_type,
|
ifi->ifi_type,
|
||||||
b1, sizeof(b1)), stdout);
|
b1, sizeof(b1)));
|
||||||
}
|
}
|
||||||
if (tb[IFLA_BROADCAST]) {
|
if (tb[IFLA_BROADCAST]) {
|
||||||
if (ifi->ifi_flags & IFF_POINTOPOINT)
|
if (ifi->ifi_flags & IFF_POINTOPOINT)
|
||||||
printf(" peer ");
|
printf(" peer ");
|
||||||
else
|
else
|
||||||
printf(" brd ");
|
printf(" brd ");
|
||||||
fputs(ll_addr_n2a(RTA_DATA(tb[IFLA_BROADCAST]),
|
fputs_stdout(ll_addr_n2a(RTA_DATA(tb[IFLA_BROADCAST]),
|
||||||
RTA_PAYLOAD(tb[IFLA_BROADCAST]),
|
RTA_PAYLOAD(tb[IFLA_BROADCAST]),
|
||||||
ifi->ifi_type,
|
ifi->ifi_type,
|
||||||
b1, sizeof(b1)), stdout);
|
b1, sizeof(b1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bb_putchar('\n');
|
bb_putchar('\n');
|
||||||
@ -307,9 +307,7 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM,
|
|||||||
printf(" family %d ", ifa->ifa_family);
|
printf(" family %d ", ifa->ifa_family);
|
||||||
|
|
||||||
if (rta_tb[IFA_LOCAL]) {
|
if (rta_tb[IFA_LOCAL]) {
|
||||||
fputs(rt_addr_n2a(ifa->ifa_family, RTA_DATA(rta_tb[IFA_LOCAL])),
|
fputs_stdout(rt_addr_n2a(ifa->ifa_family, RTA_DATA(rta_tb[IFA_LOCAL])));
|
||||||
stdout
|
|
||||||
);
|
|
||||||
|
|
||||||
if (rta_tb[IFA_ADDRESS] == NULL
|
if (rta_tb[IFA_ADDRESS] == NULL
|
||||||
|| memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_LOCAL]), 4) == 0
|
|| memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_LOCAL]), 4) == 0
|
||||||
@ -363,7 +361,7 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM,
|
|||||||
if (ifa_flags)
|
if (ifa_flags)
|
||||||
printf("flags %02x ", ifa_flags);
|
printf("flags %02x ", ifa_flags);
|
||||||
if (rta_tb[IFA_LABEL])
|
if (rta_tb[IFA_LABEL])
|
||||||
fputs((char*)RTA_DATA(rta_tb[IFA_LABEL]), stdout);
|
fputs_stdout((char*)RTA_DATA(rta_tb[IFA_LABEL]));
|
||||||
if (rta_tb[IFA_CACHEINFO]) {
|
if (rta_tb[IFA_CACHEINFO]) {
|
||||||
struct ifa_cacheinfo *ci = RTA_DATA(rta_tb[IFA_CACHEINFO]);
|
struct ifa_cacheinfo *ci = RTA_DATA(rta_tb[IFA_CACHEINFO]);
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
@ -88,10 +88,9 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM,
|
|||||||
r->rtm_src_len
|
r->rtm_src_len
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
fputs(format_host(r->rtm_family,
|
fputs_stdout(format_host(r->rtm_family,
|
||||||
RTA_PAYLOAD(tb[RTA_SRC]),
|
RTA_PAYLOAD(tb[RTA_SRC]),
|
||||||
RTA_DATA(tb[RTA_SRC])),
|
RTA_DATA(tb[RTA_SRC]))
|
||||||
stdout
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (r->rtm_src_len) {
|
} else if (r->rtm_src_len) {
|
||||||
@ -178,7 +177,7 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM,
|
|||||||
} else
|
} else
|
||||||
printf("masquerade");
|
printf("masquerade");
|
||||||
} else if (r->rtm_type != RTN_UNICAST)
|
} else if (r->rtm_type != RTN_UNICAST)
|
||||||
fputs(rtnl_rtntype_n2a(r->rtm_type), stdout);
|
fputs_stdout(rtnl_rtntype_n2a(r->rtm_type));
|
||||||
|
|
||||||
bb_putchar('\n');
|
bb_putchar('\n');
|
||||||
/*fflush_all();*/
|
/*fflush_all();*/
|
||||||
|
@ -112,7 +112,7 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
printf("%02u:%02u:%02u\n", h, m, (unsigned)expires);
|
printf("%02u:%02u:%02u\n", h, m, (unsigned)expires);
|
||||||
} else { /* -a */
|
} else { /* -a */
|
||||||
time_t t = expires_abs;
|
time_t t = expires_abs;
|
||||||
fputs(ctime(&t), stdout);
|
fputs_stdout(ctime(&t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* close(fd); */
|
/* close(fd); */
|
||||||
|
@ -818,7 +818,7 @@ int powertop_main(int argc UNUSED_PARAM, char UNUSED_PARAM **argv)
|
|||||||
|
|
||||||
for (i = 0; i < MAX_CSTATE_COUNT + 2; i++)
|
for (i = 0; i < MAX_CSTATE_COUNT + 2; i++)
|
||||||
if (cstate_lines[i][0])
|
if (cstate_lines[i][0])
|
||||||
fputs(cstate_lines[i], stdout);
|
fputs_stdout(cstate_lines[i]);
|
||||||
|
|
||||||
i = process_timer_stats();
|
i = process_timer_stats();
|
||||||
#if ENABLE_FEATURE_POWERTOP_PROCIRQ
|
#if ENABLE_FEATURE_POWERTOP_PROCIRQ
|
||||||
|
@ -712,7 +712,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
|
|||||||
);
|
);
|
||||||
if ((int)(scr_width - col) > 1)
|
if ((int)(scr_width - col) > 1)
|
||||||
read_cmdline(line_buf + col, scr_width - col, s->pid, s->comm);
|
read_cmdline(line_buf + col, scr_width - col, s->pid, s->comm);
|
||||||
fputs(line_buf, stdout);
|
fputs_stdout(line_buf);
|
||||||
/* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu,
|
/* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu,
|
||||||
cur_jif.busy - prev_jif.busy, cur_jif.total - prev_jif.total); */
|
cur_jif.busy - prev_jif.busy, cur_jif.total - prev_jif.total); */
|
||||||
s++;
|
s++;
|
||||||
|
@ -2692,7 +2692,7 @@ static int get_user_input(struct in_str *i)
|
|||||||
* Without check_and_run_traps, handler never runs.
|
* Without check_and_run_traps, handler never runs.
|
||||||
*/
|
*/
|
||||||
check_and_run_traps();
|
check_and_run_traps();
|
||||||
fputs(prompt_str, stdout);
|
fputs_stdout(prompt_str);
|
||||||
fflush_all();
|
fflush_all();
|
||||||
}
|
}
|
||||||
r = hfgetc(i->file);
|
r = hfgetc(i->file);
|
||||||
|
@ -205,7 +205,7 @@ int logread_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
cur = shbuf_tail;
|
cur = shbuf_tail;
|
||||||
#else
|
#else
|
||||||
while (cur != shbuf_tail) {
|
while (cur != shbuf_tail) {
|
||||||
fputs(shbuf_data + cur, stdout);
|
fputs_stdout(shbuf_data + cur);
|
||||||
cur += strlen(shbuf_data + cur) + 1;
|
cur += strlen(shbuf_data + cur) + 1;
|
||||||
if (cur >= shbuf_size)
|
if (cur >= shbuf_size)
|
||||||
cur = 0;
|
cur = 0;
|
||||||
@ -217,7 +217,7 @@ int logread_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
|
|
||||||
#if ENABLE_FEATURE_LOGREAD_REDUCED_LOCKING
|
#if ENABLE_FEATURE_LOGREAD_REDUCED_LOCKING
|
||||||
for (i = 0; i < len_total; i += strlen(copy + i) + 1) {
|
for (i = 0; i < len_total; i += strlen(copy + i) + 1) {
|
||||||
fputs(copy + i, stdout);
|
fputs_stdout(copy + i);
|
||||||
}
|
}
|
||||||
free(copy);
|
free(copy);
|
||||||
#endif
|
#endif
|
||||||
|
@ -87,7 +87,7 @@ gpt_print_wide36(uint16_t *s)
|
|||||||
}
|
}
|
||||||
wc[i] = 0;
|
wc[i] = 0;
|
||||||
if (wcstombs(buf, wc, sizeof(buf)) <= sizeof(buf)-1)
|
if (wcstombs(buf, wc, sizeof(buf)) <= sizeof(buf)-1)
|
||||||
fputs(printable_string(buf), stdout);
|
fputs_stdout(printable_string(buf));
|
||||||
#else
|
#else
|
||||||
char buf[37];
|
char buf[37];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -98,7 +98,7 @@ gpt_print_wide36(uint16_t *s)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
buf[i] = '\0';
|
buf[i] = '\0';
|
||||||
fputs(buf, stdout);
|
fputs_stdout(buf);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ int rev_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
#else
|
#else
|
||||||
strrev(buf, strlen(buf));
|
strrev(buf, strlen(buf));
|
||||||
#endif
|
#endif
|
||||||
fputs(buf, stdout);
|
fputs_stdout(buf);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
} while (*argv);
|
} while (*argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user