summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2014-11-26 18:34:53 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2014-11-26 18:34:53 +0000
commit35b8c30a6f0433fcbf29d035097c44d0fb8cac09 (patch)
tree42906177e3c7862b1acb0b679e9aa9d3377462ea /usr.bin
parent5482bf416acec0fc5e5f09533eef538962865157 (diff)
Prefer setvbuf() to setlinebuf() for portability; ok deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/bc/bc.y4
-rw-r--r--usr.bin/dc/dc.c6
-rw-r--r--usr.bin/gprof/gprof.c4
-rw-r--r--usr.bin/grep/grep.c4
-rw-r--r--usr.bin/last/last.c4
-rw-r--r--usr.bin/leave/leave.c4
-rw-r--r--usr.bin/patch/patch.c6
-rw-r--r--usr.bin/rup/rup.c4
-rw-r--r--usr.bin/rusers/rusers.c4
-rw-r--r--usr.bin/sed/main.c4
-rw-r--r--usr.bin/ssh/sftp.c6
-rw-r--r--usr.bin/ssh/ssh-add.c4
-rw-r--r--usr.bin/tcpbench/tcpbench.c2
-rw-r--r--usr.bin/tmux/log.c4
14 files changed, 30 insertions, 30 deletions
diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y
index f7d5a158559..735f4158090 100644
--- a/usr.bin/bc/bc.y
+++ b/usr.bin/bc/bc.y
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: bc.y,v 1.46 2014/10/14 15:35:18 deraadt Exp $ */
+/* $OpenBSD: bc.y,v 1.47 2014/11/26 18:34:51 millert Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -1095,7 +1095,7 @@ main(int argc, char *argv[])
char *q;
init();
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
sargv = reallocarray(NULL, argc, sizeof(char *));
if (sargv == NULL)
diff --git a/usr.bin/dc/dc.c b/usr.bin/dc/dc.c
index e131fe95024..eb5d661a51c 100644
--- a/usr.bin/dc/dc.c
+++ b/usr.bin/dc/dc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dc.c,v 1.12 2014/05/20 01:25:23 guenther Exp $ */
+/* $OpenBSD: dc.c,v 1.13 2014/11/26 18:34:51 millert Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -72,8 +72,8 @@ main(int argc, char *argv[])
argv += optind;
init_bmachine(extended_regs);
- (void)setlinebuf(stdout);
- (void)setlinebuf(stderr);
+ (void)setvbuf(stdout, NULL, _IOLBF, 0);
+ (void)setvbuf(stderr, NULL, _IOLBF, 0);
if (argc > 1)
usage();
diff --git a/usr.bin/gprof/gprof.c b/usr.bin/gprof/gprof.c
index d3abfad9c72..c6b1a04f1d5 100644
--- a/usr.bin/gprof/gprof.c
+++ b/usr.bin/gprof/gprof.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gprof.c,v 1.19 2009/10/27 23:59:38 deraadt Exp $ */
+/* $OpenBSD: gprof.c,v 1.20 2014/11/26 18:34:51 millert Exp $ */
/* $NetBSD: gprof.c,v 1.8 1995/04/19 07:15:59 cgd Exp $ */
/*
@@ -72,7 +72,7 @@ main(int argc, char *argv[])
break;
case 'd':
dflag = TRUE;
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
debug |= atoi( *++argv );
debug |= ANYDEBUG;
# ifdef DEBUG
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 592573b50ba..89830da8d44 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grep.c,v 1.46 2014/11/26 17:26:40 millert Exp $ */
+/* $OpenBSD: grep.c,v 1.47 2014/11/26 18:34:51 millert Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -484,7 +484,7 @@ main(int argc, char *argv[])
}
if (lbflag)
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
if ((argc == 0 || argc == 1) && !Rflag && !Hflag)
hflag = 1;
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index bd1682fc72e..6c2fa1f6f20 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: last.c,v 1.42 2014/04/22 12:36:36 okan Exp $ */
+/* $OpenBSD: last.c,v 1.43 2014/11/26 18:34:51 millert Exp $ */
/* $NetBSD: last.c,v 1.6 1994/12/24 16:49:02 cgd Exp $ */
/*
@@ -152,7 +152,7 @@ main(int argc, char *argv[])
exit(0);
if (argc) {
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
for (argv += optind; *argv; ++argv) {
#define COMPATIBILITY
#ifdef COMPATIBILITY
diff --git a/usr.bin/leave/leave.c b/usr.bin/leave/leave.c
index 888b648ba90..9bbf6db9a1d 100644
--- a/usr.bin/leave/leave.c
+++ b/usr.bin/leave/leave.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: leave.c,v 1.13 2013/11/26 13:19:07 deraadt Exp $ */
+/* $OpenBSD: leave.c,v 1.14 2014/11/26 18:34:51 millert Exp $ */
/* $NetBSD: leave.c,v 1.4 1995/07/03 16:50:13 phil Exp $ */
/*
@@ -64,7 +64,7 @@ main(int argc, char *argv[])
int plusnow = 0, twentyfour;
char buf[50];
- if (setlinebuf(stdout) != 0)
+ if (setvbuf(stdout, NULL, _IOLBF, 0) != 0)
errx(1, "Cannot set stdout to line buffered.");
if (argc < 2) {
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index fba035c33bd..dbd97c6a2ac 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: patch.c,v 1.51 2013/11/26 13:19:07 deraadt Exp $ */
+/* $OpenBSD: patch.c,v 1.52 2014/11/26 18:34:51 millert Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -147,8 +147,8 @@ main(int argc, char *argv[])
const char *tmpdir;
char *v;
- setlinebuf(stdout);
- setlinebuf(stderr);
+ setvbuf(stdout, NULL, _IOLBF, 0);
+ setvbuf(stderr, NULL, _IOLBF, 0);
for (i = 0; i < MAXFILEC; i++)
filearg[i] = NULL;
diff --git a/usr.bin/rup/rup.c b/usr.bin/rup/rup.c
index 2820933a68b..3200cfb01a0 100644
--- a/usr.bin/rup/rup.c
+++ b/usr.bin/rup/rup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rup.c,v 1.27 2014/10/08 04:08:13 doug Exp $ */
+/* $OpenBSD: rup.c,v 1.28 2014/11/26 18:34:51 millert Exp $ */
/*-
* Copyright (c) 1993, John Brezak
@@ -314,7 +314,7 @@ main(int argc, char *argv[])
/*NOTREACHED*/
}
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
if (argc == optind)
allhosts();
diff --git a/usr.bin/rusers/rusers.c b/usr.bin/rusers/rusers.c
index bf07730d6b1..7d991526d4f 100644
--- a/usr.bin/rusers/rusers.c
+++ b/usr.bin/rusers/rusers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rusers.c,v 1.32 2014/10/08 04:08:47 doug Exp $ */
+/* $OpenBSD: rusers.c,v 1.33 2014/11/26 18:34:51 millert Exp $ */
/*
* Copyright (c) 2001, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -152,7 +152,7 @@ main(int argc, char **argv)
termwidth = 80;
} else
termwidth = 80;
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
if (argc == optind) {
if (hflag || iflag || uflag) {
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c
index f50cb7e479f..d7cc3743161 100644
--- a/usr.bin/sed/main.c
+++ b/usr.bin/sed/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.17 2009/10/27 23:59:43 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.18 2014/11/26 18:34:51 millert Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
@@ -118,7 +118,7 @@ main(int argc, char *argv[])
nflag = 1;
break;
case 'u':
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
break;
default:
case '?':
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c
index 43f8745a88f..12d30d6239b 100644
--- a/usr.bin/ssh/sftp.c
+++ b/usr.bin/ssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.167 2014/10/06 00:47:15 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.168 2014/11/26 18:34:51 millert Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -2059,8 +2059,8 @@ interactive_loop(struct sftp_conn *conn, char *file1, char *file2)
free(dir);
}
- setlinebuf(stdout);
- setlinebuf(infile);
+ setvbuf(stdout, NULL, _IOLBF, 0);
+ setvbuf(infile, NULL, _IOLBF, 0);
interactive = !batchmode && isatty(STDIN_FILENO);
err = 0;
diff --git a/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c
index 3265072f7a6..fa224afe541 100644
--- a/usr.bin/ssh/ssh-add.c
+++ b/usr.bin/ssh/ssh-add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-add.c,v 1.113 2014/07/09 14:15:56 benno Exp $ */
+/* $OpenBSD: ssh-add.c,v 1.114 2014/11/26 18:34:51 millert Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -428,7 +428,7 @@ main(int argc, char **argv)
OpenSSL_add_all_algorithms();
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
/* At first, get a connection to the authentication agent. */
ac = ssh_get_authentication_connection();
diff --git a/usr.bin/tcpbench/tcpbench.c b/usr.bin/tcpbench/tcpbench.c
index 7832bf71fad..a9e83873ed9 100644
--- a/usr.bin/tcpbench/tcpbench.c
+++ b/usr.bin/tcpbench/tcpbench.c
@@ -1003,7 +1003,7 @@ main(int argc, char **argv)
struct statctx *udp_sc = NULL;
/* Init world */
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
ptb = &tcpbench;
ptb->dummybuf_len = 0;
ptb->Sflag = ptb->sflag = ptb->vflag = 0;
diff --git a/usr.bin/tmux/log.c b/usr.bin/tmux/log.c
index 0680ac4e120..e9708712184 100644
--- a/usr.bin/tmux/log.c
+++ b/usr.bin/tmux/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.11 2014/10/20 23:57:13 nicm Exp $ */
+/* $OpenBSD: log.c,v 1.12 2014/11/26 18:34:51 millert Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -45,7 +45,7 @@ log_open(const char *path)
if (log_file == NULL)
return;
- setlinebuf(log_file);
+ setvbuf(log_file, NULL, _IOLBF, 0);
event_set_log_callback(log_event_cb);
tzset();