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>
diff --git a/applets/individual.c b/applets/individual.c
index 4c468df..e94f26c 100644
--- a/applets/individual.c
+++ b/applets/individual.c
@@ -19,6 +19,6 @@
 
 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 dae6089..4b34149 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -152,7 +152,7 @@
 				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 1acbb51..16418ff 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -167,7 +167,7 @@
 						 * 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 5f59939..c5e1de6 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -123,7 +123,7 @@
 			}
 			ptr++;
 		}
-		fputs(ptr_strbeg, stdout);
+		fputs_stdout(ptr_strbeg);
 		free(line);
 	}
 }
diff --git a/coreutils/head.c b/coreutils/head.c
index 1219dfe..b6efabb 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -117,7 +117,7 @@
 		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 78d5f2a..f453a87 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -258,7 +258,7 @@
 			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 e5375a6..80ef920 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -453,7 +453,7 @@
 	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 d5bd7bf..5b5e56a 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -422,19 +422,19 @@
 
 		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 @@
 
 		if (ISPRINT(c)) {
 			buf[3] = c;
-			fputs(buf, stdout);
+			fputs_stdout(buf);
 			continue;
 		}
 		switch (c) {
@@ -485,7 +485,7 @@
 			buf[8] = (c & 7) + '0';
 			s = buf + 5;
 		}
-		fputs(s, stdout);
+		fputs_stdout(s);
 	}
 }
 
@@ -881,7 +881,7 @@
 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 @@
 
 		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 fd2aa50..7def4de 100644
--- a/coreutils/paste.c
+++ b/coreutils/paste.c
@@ -53,7 +53,7 @@
 				--active_files;
 				continue;
 			}
-			fputs(line, stdout);
+			fputs_stdout(line);
 			free(line);
 			delim = '\n';
 			if (i != file_cnt - 1) {
@@ -79,7 +79,7 @@
 		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 073b2c6..a839346 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -439,7 +439,7 @@
 
 		/* 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 1925396..ba2b783 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -855,7 +855,7 @@
 			}
 		}
 	}
-	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 164b208..02b0372 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -319,7 +319,7 @@
 			}
 
 			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 9a435a7..0ad2592 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -43,7 +43,7 @@
 	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 d3ae8da..c50faee 100644
--- a/editors/ed.c
+++ b/editors/ed.c
@@ -553,7 +553,7 @@
 			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 adfb2b8..458ca62 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -522,7 +522,7 @@
 
 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 cb63364..135d911 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -874,6 +874,7 @@
 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 2dcead3..66d6a47 100644
--- a/libbb/bb_askpass.c
+++ b/libbb/bb_askpass.c
@@ -25,7 +25,7 @@
 	/* 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 1ba1132..fb7849e 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -560,7 +560,7 @@
 						) {
 							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 75de88e..367396b 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -312,7 +312,7 @@
 		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 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 @@
 	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 @@
 #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 7f593d8..af860c2 100644
--- a/libbb/login.c
+++ b/libbb/login.c
@@ -120,7 +120,7 @@
 				buf[0] = c;
 			}
 		}
-		fputs(outbuf, stdout);
+		fputs_stdout(outbuf);
 	}
 	fclose(fp);
 	fflush_all();
@@ -130,8 +130,8 @@
 {
 	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 4758068..b64f855 100644
--- a/libbb/print_numbered_lines.c
+++ b/libbb/print_numbered_lines.c
@@ -25,7 +25,7 @@
 			printf("%*u%s", ns->width, N, ns->sep);
 			N += ns->inc;
 		} else if (ns->empty_str)
-			fputs(ns->empty_str, stdout);
+			fputs_stdout(ns->empty_str);
 		puts(line);
 		free(line);
 	}
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index 99596b9..f0399ca 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -318,6 +318,11 @@
 	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 53eb5c7..02a61ac 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -6448,7 +6448,7 @@
 		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 fac11d3..21a498d 100644
--- a/miscutils/conspy.c
+++ b/miscutils/conspy.c
@@ -107,8 +107,8 @@
 
 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 51412f4..e4a6822 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -92,7 +92,7 @@
 						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 f057f9b..e1f3e64 100644
--- a/networking/brctl.c
+++ b/networking/brctl.c
@@ -156,7 +156,7 @@
 	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 3cad289..e6757d9 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -2788,12 +2788,12 @@
 			, &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/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index dfd84c0..17a8384 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -192,20 +192,20 @@
 		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 @@
 		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 @@
 	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 50acfe4..a23a00d 100644
--- a/networking/libiproute/iprule.c
+++ b/networking/libiproute/iprule.c
@@ -88,10 +88,9 @@
 				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 @@
 		} 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 1e94052..19606c5 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -112,7 +112,7 @@
 			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 d508b5f..fc6018b 100644
--- a/procps/powertop.c
+++ b/procps/powertop.c
@@ -818,7 +818,7 @@
 
 		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 8d39526..cadc4ec 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -712,7 +712,7 @@
 		);
 		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 77f90f8..5eb6fa3 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2692,7 +2692,7 @@
 			 * 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 b52dc9c..d5f8ca0 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -205,7 +205,7 @@
 		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 @@
 
 #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 e884e3d..4c30f31 100644
--- a/util-linux/fdisk_gpt.c
+++ b/util-linux/fdisk_gpt.c
@@ -87,7 +87,7 @@
 	}
 	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 @@
 		i++;
 	}
 	buf[i] = '\0';
-	fputs(buf, stdout);
+	fputs_stdout(buf);
 #endif
 }
 
diff --git a/util-linux/rev.c b/util-linux/rev.c
index ede4fbc..d439b4d 100644
--- a/util-linux/rev.c
+++ b/util-linux/rev.c
@@ -108,7 +108,7 @@
 #else
 			strrev(buf, strlen(buf));
 #endif
-			fputs(buf, stdout);
+			fputs_stdout(buf);
 		}
 		fclose(fp);
 	} while (*argv);