networking/httpd_ssi.c should not be touched.

Applied excluding that chunk. Thank you.

On Thu, Jan 21, 2021 at 1:09 PM Ron Yorston <r...@pobox.com> wrote:
>
> 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
>    text    data     bss     dec     hex filename
>  955071    4187    1808  961066   eaa2a busybox_old
>  954742    4187    1808  960737   ea8e1 busybox_unstripped
>
> Signed-off-by: Ron Yorston <r...@pobox.com>
> ---
>  applets/individual.c              |  2 +-
>  coreutils/cat.c                   |  2 +-
>  coreutils/cut.c                   |  2 +-
>  coreutils/expand.c                |  2 +-
>  coreutils/head.c                  |  2 +-
>  coreutils/id.c                    |  2 +-
>  coreutils/ls.c                    |  2 +-
>  coreutils/od_bloaty.c             | 26 +++++++++++++-------------
>  coreutils/paste.c                 |  4 ++--
>  coreutils/stat.c                  |  2 +-
>  coreutils/stty.c                  |  2 +-
>  coreutils/uudecode.c              |  2 +-
>  coreutils/yes.c                   |  2 +-
>  editors/ed.c                      |  2 +-
>  editors/vi.c                      |  2 +-
>  include/libbb.h                   |  1 +
>  libbb/bb_askpass.c                |  2 +-
>  libbb/dump.c                      |  2 +-
>  libbb/lineedit.c                  |  8 ++++----
>  libbb/login.c                     |  6 +++---
>  libbb/print_numbered_lines.c      |  2 +-
>  libbb/xfuncs_printf.c             |  5 +++++
>  miscutils/bc.c                    |  2 +-
>  miscutils/conspy.c                |  4 ++--
>  miscutils/strings.c               |  2 +-
>  networking/brctl.c                |  2 +-
>  networking/httpd.c                |  4 ++--
>  networking/httpd_ssi.c            | 17 ++++++++---------
>  networking/libiproute/ipaddress.c | 14 ++++++--------
>  networking/libiproute/iprule.c    |  7 +++----
>  networking/udhcp/dumpleases.c     |  2 +-
>  procps/powertop.c                 |  2 +-
>  procps/top.c                      |  2 +-
>  shell/hush.c                      |  2 +-
>  sysklogd/logread.c                |  4 ++--
>  util-linux/fdisk_gpt.c            |  4 ++--
>  util-linux/rev.c                  |  2 +-
>  37 files changed, 77 insertions(+), 75 deletions(-)
>
> diff --git a/applets/individual.c b/applets/individual.c
> index 4c468df06..e94f26c93 100644
> --- a/applets/individual.c
> +++ b/applets/individual.c
> @@ -19,6 +19,6 @@ int main(int argc, char **argv)
>
>  void bb_show_usage(void)
>  {
> -       fputs(APPLET_full_usage "\n", stdout);
> +       fputs_stdout(APPLET_full_usage "\n");
>         exit(EXIT_FAILURE);
>  }
> diff --git a/coreutils/cat.c b/coreutils/cat.c
> index 65f0648f9..e1ddce7fc 100644
> --- a/coreutils/cat.c
> +++ b/coreutils/cat.c
> @@ -152,7 +152,7 @@ static int catv(unsigned opts, char **argv)
>                                 eol_seen = (c == eol_char);
>  #endif
>                                 visible(c, buf, opts);
> -                               fputs(buf, stdout);
> +                               fputs_stdout(buf);
>                         }
>                 }
>                 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
>                                                  * printed */
>                                                 if (nfields_printed > 0)
>                                                         putchar(delim);
> -                                               fputs(field, stdout);
> +                                               fputs_stdout(field);
>                                                 printed[ndelim] = 'X';
>                                                 nfields_printed++;      /* 
> shouldn't overflow.. */
>                                         }
> 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)
>                         }
>                         ptr++;
>                 }
> -               fputs(ptr_strbeg, stdout);
> +               fputs_stdout(ptr_strbeg);
>                 free(line);
>         }
>  }
> 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)
>                 char *c;
>                 if (head == count)
>                         head = 0;
> -               fputs(circle[head], stdout);
> +               fputs_stdout(circle[head]);
>                 c = xmalloc_fgets(fp);
>                 if (!c)
>                         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)
>                         bb_error_msg_and_die("can't get process context%s",
>                                 username ? " for a different user" : "");
>                 }
> -               fputs(scontext, stdout);
> +               fputs_stdout(scontext);
>         }
>         /* freecon(NULL) seems to be harmless */
>         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)
>         name = printable_string2(&uni_stat, name);
>
>         if (!(option_mask32 & OPT_Q)) {
> -               fputs(name, stdout);
> +               fputs_stdout(name);
>                 return uni_stat.unicode_width;
>         }
>
> 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,
>
>                 masked_c &= 0x7f;
>                 if (masked_c == 0x7f) {
> -                       fputs(" del", stdout);
> +                       fputs_stdout(" del");
>                         continue;
>                 }
>                 if (masked_c > ' ') {
>                         buf[3] = masked_c;
> -                       fputs(buf, stdout);
> +                       fputs_stdout(buf);
>                         continue;
>                 }
>                 /* Why? Because printf(" %3.3s") is much slower... */
>                 buf[6] = charname[masked_c][0];
>                 buf[7] = charname[masked_c][1];
>                 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)) {
>                         buf[3] = c;
> -                       fputs(buf, stdout);
> +                       fputs_stdout(buf);
>                         continue;
>                 }
>                 switch (c) {
> @@ -485,7 +485,7 @@ print_ascii(size_t n_bytes, const char *block,
>                         buf[8] = (c & 7) + '0';
>                         s = buf + 5;
>                 }
> -               fputs(s, stdout);
> +               fputs_stdout(s);
>         }
>  }
>
> @@ -881,7 +881,7 @@ format_address_label(off_t address, char c)
>  static void
>  dump_hexl_mode_trailer(size_t n_bytes, const char *block)
>  {
> -       fputs("  >", stdout);
> +       fputs_stdout("  >");
>         while (n_bytes--) {
>                 unsigned c = *(unsigned char *) block++;
>                 c = (ISPRINT(c) ? c : '.');
> @@ -1121,13 +1121,13 @@ dump_strings(off_t address, off_t end_offset)
>
>                 for (i = 0; (c = buf[i]); i++) {
>                         switch (c) {
> -                       case '\007': fputs("\\a", stdout); break;
> -                       case '\b': fputs("\\b", stdout); break;
> -                       case '\f': fputs("\\f", stdout); break;
> -                       case '\n': fputs("\\n", stdout); break;
> -                       case '\r': fputs("\\r", stdout); break;
> -                       case '\t': fputs("\\t", stdout); break;
> -                       case '\v': fputs("\\v", stdout); break;
> +                       case '\007': fputs_stdout("\\a"); break;
> +                       case '\b': fputs_stdout("\\b"); break;
> +                       case '\f': fputs_stdout("\\f"); break;
> +                       case '\n': fputs_stdout("\\n"); break;
> +                       case '\r': fputs_stdout("\\r"); break;
> +                       case '\t': fputs_stdout("\\t"); break;
> +                       case '\v': fputs_stdout("\\v"); break;
>                         default: putchar(c);
>                         }
>                 }
> 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)
>                                 --active_files;
>                                 continue;
>                         }
> -                       fputs(line, stdout);
> +                       fputs_stdout(line);
>                         free(line);
>                         delim = '\n';
>                         if (i != file_cnt - 1) {
> @@ -79,7 +79,7 @@ static void paste_files_separate(FILE** files, char* 
> delims, int del_cnt)
>                 line = NULL;
>                 while ((next_line = xmalloc_fgetline(files[i])) != NULL) {
>                         if (line) {
> -                               fputs(line, stdout);
> +                               fputs_stdout(line);
>                                 free(line);
>                                 delim = delims[del_idx++];
>                                 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,
>
>                 /* print preceding string */
>                 *p = '\0';
> -               fputs(b, stdout);
> +               fputs_stdout(b);
>
>                 p += len;
>                 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, ...)
>                         }
>                 }
>         }
> -       fputs(buf, stdout);
> +       fputs_stdout(buf);
>         G.current_col += buflen;
>         if (buf[buflen-1] == '\n')
>                 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)
>                         }
>
>                         if (col == 0) {
> -                               fputs(dst_buf, stdout);
> +                               fputs_stdout(dst_buf);
>                         } else {
>                                 char *result = dst_buf;
>                                 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)
>         do {
>                 pp = argv;
>                 while (1) {
> -                       fputs(*pp, stdout);
> +                       fputs_stdout(*pp);
>                         if (!*++pp)
>                                 break;
>                         putchar(' ');
> diff --git a/editors/ed.c b/editors/ed.c
> index d3ae8da92..c50faeefa 100644
> --- a/editors/ed.c
> +++ b/editors/ed.c
> @@ -553,7 +553,7 @@ static int printLines(int num1, int num2, int expandFlag)
>                         fputc_printable(ch | PRINTABLE_META, stdout);
>                 }
>
> -               fputs("$\n", stdout);
> +               fputs_stdout("$\n");
>
>                 setCurNum(num1++);
>                 lp = lp->next;
> diff --git a/editors/vi.c b/editors/vi.c
> index 01597fa5e..9cfa9b332 100644
> --- a/editors/vi.c
> +++ b/editors/vi.c
> @@ -522,7 +522,7 @@ static void show_help(void)
>
>  static void write1(const char *out)
>  {
> -       fputs(out, stdout);
> +       fputs_stdout(out);
>  }
>
>  #if ENABLE_FEATURE_VI_WIN_RESIZE
> diff --git a/include/libbb.h b/include/libbb.h
> index cb6336474..135d9111d 100644
> --- a/include/libbb.h
> +++ b/include/libbb.h
> @@ -874,6 +874,7 @@ char *xmalloc_substitute_string(const char *src, int 
> count, const char *sub, con
>  int bb_putchar(int ch) FAST_FUNC;
>  /* Note: does not use stdio, writes to fd 2 directly */
>  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 *auto_string(char *str) FAST_FUNC;
>  // gcc-4.1.1 still isn't good enough at optimizing it
> diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c
> index 2dcead35a..66d6a479e 100644
> --- a/libbb/bb_askpass.c
> +++ b/libbb/bb_askpass.c
> @@ -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,
>          * which was upsetting "expect" based scripts of some users.
>          */
> -       fputs(prompt, stdout);
> +       fputs_stdout(prompt);
>         fflush_all();
>
>         tcgetattr(fd, &oldtio);
> diff --git a/libbb/dump.c b/libbb/dump.c
> index 1ba1132b3..fb7849e7d 100644
> --- a/libbb/dump.c
> +++ b/libbb/dump.c
> @@ -560,7 +560,7 @@ static void display(priv_dumper_t* dumper)
>                                                 ) {
>                                                         if 
> (dumper->pub.eofstring) {
>                                                                 /* xxd 
> support: requested to not pad incomplete blocks */
> -                                                               
> fputs(dumper->pub.eofstring, stdout);
> +                                                               
> fputs_stdout(dumper->pub.eofstring);
>                                                                 return;
>                                                         }
>                                                         if (!(pr->flags & 
> (F_TEXT | F_BPAD)))
> diff --git a/libbb/lineedit.c b/libbb/lineedit.c
> index 75de88e77..367396b91 100644
> --- a/libbb/lineedit.c
> +++ b/libbb/lineedit.c
> @@ -312,7 +312,7 @@ static void BB_PUTCHAR(wchar_t c)
>                 ssize_t len = wcrtomb(buf, c, &mbst);
>                 if (len > 0) {
>                         buf[len] = '\0';
> -                       fputs(buf, stdout);
> +                       fputs_stdout(buf);
>                 }
>         } else {
>                 /* In this case, c is always one byte */
> @@ -460,7 +460,7 @@ static void beep(void)
>   */
>  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;
>         cmdedit_y = cmdedit_prmt_len / cmdedit_termw; /* new quasireal y */
>         cmdedit_x = cmdedit_prmt_len % cmdedit_termw;
> @@ -1851,7 +1851,7 @@ static void ask_terminal(void)
>         pfd.events = POLLIN;
>         if (safe_poll(&pfd, 1, 0) == 0) {
>                 S.sent_ESC_br6n = 1;
> -               fputs(ESC"[6n", stdout);
> +               fputs_stdout(ESC"[6n");
>                 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
>  int FAST_FUNC read_line_input(const char* prompt, char* command, int maxsize)
>  {
> -       fputs(prompt, stdout);
> +       fputs_stdout(prompt);
>         fflush_all();
>         if (!fgets(command, maxsize, stdin))
>                 return -1;
> diff --git a/libbb/login.c b/libbb/login.c
> index 7f593d80d..af860c277 100644
> --- a/libbb/login.c
> +++ b/libbb/login.c
> @@ -120,7 +120,7 @@ void FAST_FUNC print_login_issue(const char *issue_file, 
> const char *tty)
>                                 buf[0] = c;
>                         }
>                 }
> -               fputs(outbuf, stdout);
> +               fputs_stdout(outbuf);
>         }
>         fclose(fp);
>         fflush_all();
> @@ -130,8 +130,8 @@ void FAST_FUNC print_login_prompt(void)
>  {
>         char *hostname = safe_gethostname();
>
> -       fputs(hostname, stdout);
> -       fputs(LOGIN, stdout);
> +       fputs_stdout(hostname);
> +       fputs_stdout(LOGIN);
>         fflush_all();
>         free(hostname);
>  }
> diff --git a/libbb/print_numbered_lines.c b/libbb/print_numbered_lines.c
> index d6459d7c3..e1219b197 100644
> --- a/libbb/print_numbered_lines.c
> +++ b/libbb/print_numbered_lines.c
> @@ -25,7 +25,7 @@ int FAST_FUNC print_numbered_lines(struct number_state *ns, 
> const char *filename
>                         printf("%*u%s%s\n", ns->width, N, ns->sep, line);
>                         N += ns->inc;
>                 } else if (ns->empty_str)
> -                       fputs(ns->empty_str, stdout);
> +                       fputs_stdout(ns->empty_str);
>                 free(line);
>         }
>         ns->start = N;
> diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
> index 99596b9d0..f0399ca45 100644
> --- a/libbb/xfuncs_printf.c
> +++ b/libbb/xfuncs_printf.c
> @@ -318,6 +318,11 @@ int FAST_FUNC bb_putchar(int 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,
>   * then close that file. */
>  void FAST_FUNC xprint_and_close_file(FILE *file)
> diff --git a/miscutils/bc.c b/miscutils/bc.c
> index 53eb5c799..02a61ac49 100644
> --- a/miscutils/bc.c
> +++ b/miscutils/bc.c
> @@ -6448,7 +6448,7 @@ static BC_STATUS zdc_program_printStream(void)
>                 char *str;
>                 idx = (r->t == XC_RESULT_STR) ? r->d.id.idx : n->rdx;
>                 str = *xc_program_str(idx);
> -               fputs(str, stdout);
> +               fputs_stdout(str);
>         }
>
>         RETURN_STATUS(s);
> diff --git a/miscutils/conspy.c b/miscutils/conspy.c
> index fac11d339..21a498d0f 100644
> --- a/miscutils/conspy.c
> +++ b/miscutils/conspy.c
> @@ -107,8 +107,8 @@ enum {
>
>  static void putcsi(const char *s)
>  {
> -       fputs(ESC"[", stdout);
> -       fputs(s, stdout);
> +       fputs_stdout(ESC"[");
> +       fputs_stdout(s);
>  }
>
>  static void clrscr(void)
> diff --git a/miscutils/strings.c b/miscutils/strings.c
> index 51412f401..e4a68227e 100644
> --- a/miscutils/strings.c
> +++ b/miscutils/strings.c
> @@ -92,7 +92,7 @@ int strings_main(int argc UNUSED_PARAM, char **argv)
>                                                 if (option_mask32 & 
> (PRINT_OFFSET | PRINT_RADIX)) {
>                                                         printf(radix_fmt, 
> offset - n);
>                                                 }
> -                                               fputs(string, stdout);
> +                                               fputs_stdout(string);
>                                         }
>                                         count++;
>                                 }
> diff --git a/networking/brctl.c b/networking/brctl.c
> index f057f9b60..e1f3e6445 100644
> --- a/networking/brctl.c
> +++ b/networking/brctl.c
> @@ -156,7 +156,7 @@ static int show_bridge(const char *name, int need_hdr)
>         else
>         if (LONE_CHAR(filedata, '1'))
>                 strcpy(filedata, "yes");
> -       fputs(filedata, stdout);
> +       fputs_stdout(filedata);
>
>         /* sfx points past "BR/bridge/", turn it into "BR/brif": */
>         sfx[-4] = 'f'; sfx[-3] = '\0';
> diff --git a/networking/httpd.c b/networking/httpd.c
> index 3cad28921..e6757d943 100644
> --- a/networking/httpd.c
> +++ b/networking/httpd.c
> @@ -2788,12 +2788,12 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
>                         , &verbose
>                 );
>         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;
>         }
>  #if ENABLE_FEATURE_HTTPD_ENCODE_URL_STR
>         if (opt & OPT_ENCODE_URL) {
> -               fputs(encodeString(url_for_encode), stdout);
> +               fputs_stdout(encodeString(url_for_encode));
>                 return 0;
>         }
>  #endif
> diff --git a/networking/httpd_ssi.c b/networking/httpd_ssi.c
> index 4bd9a6d97..bfb33da34 100644
> --- a/networking/httpd_ssi.c
> +++ b/networking/httpd_ssi.c
> @@ -87,7 +87,7 @@ static void process_includes(const char *filename)
>
>                 include_directive = strstr(line, INCLUDE);
>                 if (!include_directive) {
> -                       fputs(line, stdout);
> +                       fputs_stdout(line);
>                         continue;
>                 }
>                 preceding_len = include_directive - line;
> @@ -96,20 +96,20 @@ static void process_includes(const char *filename)
>                 ) {
>                         /* INCLUDE string may be inside "str" or 'str',
>                          * ignore it */
> -                       fputs(line, stdout);
> +                       fputs_stdout(line);
>                         continue;
>                 }
>                 /* Small bug: we accept #includefile="file" too */
>                 include_directive = skip_whitespace(include_directive + 
> sizeof(INCLUDE)-1);
>                 if (strncmp(include_directive, "file=\"", 6) != 0) {
>                         /* "<!--#include virtual=..."? - not supported */
> -                       fputs(line, stdout);
> +                       fputs_stdout(line);
>                         continue;
>                 }
>                 include_directive += 6; /* now it points to file name */
>                 end = strchr(include_directive, '\"');
>                 if (!end) {
> -                       fputs(line, stdout);
> +                       fputs_stdout(line);
>                         continue;
>                 }
>                 /* We checked that this is a valid include directive */
> @@ -117,7 +117,7 @@ static void process_includes(const char *filename)
>                 /* Print everything before directive */
>                 if (preceding_len) {
>                         line[preceding_len] = '\0';
> -                       fputs(line, stdout);
> +                       fputs_stdout(line);
>                 }
>                 /* Save everything after directive */
>                 *end++ = '\0';
> @@ -134,7 +134,7 @@ static void process_includes(const char *filename)
>
>                 /* Print everything after directive */
>                 if (end) {
> -                       fputs(end, stdout);
> +                       fputs_stdout(end);
>                         free(end);
>                 }
>         }
> @@ -156,14 +156,13 @@ int main(int argc, char *argv[])
>          * Connection: close
>          * Content-Type: text/html
>          */
> -       fputs(
> +       fputs_stdout(
>                 /* "Date: Thu, 10 Sep 2009 18:23:28 GMT\r\n" */
>                 /* "Server: Apache\r\n" */
>                 /* "Accept-Ranges: bytes\r\n" - do we really accept bytes?! */
>                 "Connection: close\r\n"
>                 "Content-Type: text/html\r\n"
> -               "\r\n",
> -               stdout
> +               "\r\n"
>         );
>         process_includes(argv[1]);
>         return 0;
> diff --git a/networking/libiproute/ipaddress.c 
> b/networking/libiproute/ipaddress.c
> index dfd84c000..17a838411 100644
> --- a/networking/libiproute/ipaddress.c
> +++ b/networking/libiproute/ipaddress.c
> @@ -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));
>
>                 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]),
>                                                       ifi->ifi_type,
> -                                                     b1, sizeof(b1)), 
> stdout);
> +                                                     b1, sizeof(b1)));
>                 }
>                 if (tb[IFLA_BROADCAST]) {
>                         if (ifi->ifi_flags & IFF_POINTOPOINT)
>                                 printf(" peer ");
>                         else
>                                 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]),
>                                                       ifi->ifi_type,
> -                                                     b1, sizeof(b1)), 
> stdout);
> +                                                     b1, sizeof(b1)));
>                 }
>         }
>         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);
>
>         if (rta_tb[IFA_LOCAL]) {
> -               fputs(rt_addr_n2a(ifa->ifa_family, 
> RTA_DATA(rta_tb[IFA_LOCAL])),
> -                       stdout
> -               );
> +               fputs_stdout(rt_addr_n2a(ifa->ifa_family, 
> RTA_DATA(rta_tb[IFA_LOCAL])));
>
>                 if (rta_tb[IFA_ADDRESS] == NULL
>                  || 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)
>                 printf("flags %02x ", ifa_flags);
>         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]) {
>                 struct ifa_cacheinfo *ci = RTA_DATA(rta_tb[IFA_CACHEINFO]);
>                 char buf[128];
> diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c
> index 50acfe4e7..a23a00d87 100644
> --- a/networking/libiproute/iprule.c
> +++ b/networking/libiproute/iprule.c
> @@ -88,10 +88,9 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl 
> *who UNUSED_PARAM,
>                                 r->rtm_src_len
>                         );
>                 } else {
> -                       fputs(format_host(r->rtm_family,
> +                       fputs_stdout(format_host(r->rtm_family,
>                                                 RTA_PAYLOAD(tb[RTA_SRC]),
> -                                               RTA_DATA(tb[RTA_SRC])),
> -                               stdout
> +                                               RTA_DATA(tb[RTA_SRC]))
>                         );
>                 }
>         } else if (r->rtm_src_len) {
> @@ -178,7 +177,7 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl 
> *who UNUSED_PARAM,
>                 } else
>                         printf("masquerade");
>         } 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');
>         /*fflush_all();*/
> diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
> index 1e9405205..19606c58e 100644
> --- a/networking/udhcp/dumpleases.c
> +++ b/networking/udhcp/dumpleases.c
> @@ -112,7 +112,7 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
>                         printf("%02u:%02u:%02u\n", h, m, (unsigned)expires);
>                 } else { /* -a */
>                         time_t t = expires_abs;
> -                       fputs(ctime(&t), stdout);
> +                       fputs_stdout(ctime(&t));
>                 }
>         }
>         /* close(fd); */
> diff --git a/procps/powertop.c b/procps/powertop.c
> index d508b5f78..fc6018b7a 100644
> --- a/procps/powertop.c
> +++ b/procps/powertop.c
> @@ -818,7 +818,7 @@ int powertop_main(int argc UNUSED_PARAM, char 
> UNUSED_PARAM **argv)
>
>                 for (i = 0; i < MAX_CSTATE_COUNT + 2; i++)
>                         if (cstate_lines[i][0])
> -                               fputs(cstate_lines[i], stdout);
> +                               fputs_stdout(cstate_lines[i]);
>
>                 i = process_timer_stats();
>  #if ENABLE_FEATURE_POWERTOP_PROCIRQ
> diff --git a/procps/top.c b/procps/top.c
> index 8d39526ff..cadc4ecec 100644
> --- a/procps/top.c
> +++ b/procps/top.c
> @@ -712,7 +712,7 @@ static NOINLINE void display_process_list(int lines_rem, 
> int scr_width)
>                 );
>                 if ((int)(scr_width - col) > 1)
>                         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,
>                         cur_jif.busy - prev_jif.busy, cur_jif.total - 
> prev_jif.total); */
>                 s++;
> diff --git a/shell/hush.c b/shell/hush.c
> index 77f90f82f..5eb6fa396 100644
> --- a/shell/hush.c
> +++ b/shell/hush.c
> @@ -2692,7 +2692,7 @@ static int get_user_input(struct in_str *i)
>                          * Without check_and_run_traps, handler never runs.
>                          */
>                         check_and_run_traps();
> -                       fputs(prompt_str, stdout);
> +                       fputs_stdout(prompt_str);
>                         fflush_all();
>                 }
>                 r = hfgetc(i->file);
> diff --git a/sysklogd/logread.c b/sysklogd/logread.c
> index b52dc9cac..d5f8ca0a2 100644
> --- a/sysklogd/logread.c
> +++ b/sysklogd/logread.c
> @@ -205,7 +205,7 @@ int logread_main(int argc UNUSED_PARAM, char **argv)
>                 cur = shbuf_tail;
>  #else
>                 while (cur != shbuf_tail) {
> -                       fputs(shbuf_data + cur, stdout);
> +                       fputs_stdout(shbuf_data + cur);
>                         cur += strlen(shbuf_data + cur) + 1;
>                         if (cur >= shbuf_size)
>                                 cur = 0;
> @@ -217,7 +217,7 @@ int logread_main(int argc UNUSED_PARAM, char **argv)
>
>  #if ENABLE_FEATURE_LOGREAD_REDUCED_LOCKING
>                 for (i = 0; i < len_total; i += strlen(copy + i) + 1) {
> -                       fputs(copy + i, stdout);
> +                       fputs_stdout(copy + i);
>                 }
>                 free(copy);
>  #endif
> diff --git a/util-linux/fdisk_gpt.c b/util-linux/fdisk_gpt.c
> index e884e3dc1..4c30f31f8 100644
> --- a/util-linux/fdisk_gpt.c
> +++ b/util-linux/fdisk_gpt.c
> @@ -87,7 +87,7 @@ gpt_print_wide36(uint16_t *s)
>         }
>         wc[i] = 0;
>         if (wcstombs(buf, wc, sizeof(buf)) <= sizeof(buf)-1)
> -               fputs(printable_string(buf), stdout);
> +               fputs_stdout(printable_string(buf));
>  #else
>         char buf[37];
>         int i = 0;
> @@ -98,7 +98,7 @@ gpt_print_wide36(uint16_t *s)
>                 i++;
>         }
>         buf[i] = '\0';
> -       fputs(buf, stdout);
> +       fputs_stdout(buf);
>  #endif
>  }
>
> diff --git a/util-linux/rev.c b/util-linux/rev.c
> index ede4fbc9c..d439b4da8 100644
> --- a/util-linux/rev.c
> +++ b/util-linux/rev.c
> @@ -108,7 +108,7 @@ int rev_main(int argc UNUSED_PARAM, char **argv)
>  #else
>                         strrev(buf, strlen(buf));
>  #endif
> -                       fputs(buf, stdout);
> +                       fputs_stdout(buf);
>                 }
>                 fclose(fp);
>         } while (*argv);
> --
> 2.29.2
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to