Hi there,

setbuf(3) etc "are obsoleted by setvbuf(3)" and "should be avoided".
The patch below replaces all occurrences in libc man pages and
src/regress.

Cheers,
Frederic

Index: libc/stdio/fclose.3
===================================================================
RCS file: /cvs/src/lib/libc/stdio/fclose.3,v
retrieving revision 1.8
diff -u -p -r1.8 fclose.3
--- libc/stdio/fclose.3 17 Jul 2013 05:42:11 -0000      1.8
+++ libc/stdio/fclose.3 4 Nov 2015 20:28:56 -0000
@@ -78,7 +78,7 @@ or
 .Xr close 2 ,
 .Xr fflush 3 ,
 .Xr fopen 3 ,
-.Xr setbuf 3
+.Xr setvbuf 3
 .Sh STANDARDS
 The
 .Fn fclose
Index: libc/stdio/fflush.3
===================================================================
RCS file: /cvs/src/lib/libc/stdio/fflush.3,v
retrieving revision 1.11
diff -u -p -r1.11 fflush.3
--- libc/stdio/fflush.3 13 Mar 2015 19:58:40 -0000      1.11
+++ libc/stdio/fflush.3 4 Nov 2015 20:28:56 -0000
@@ -97,7 +97,7 @@ for any of the errors specified for the 
 .Xr write 2 ,
 .Xr fclose 3 ,
 .Xr fopen 3 ,
-.Xr setbuf 3
+.Xr setvbuf 3
 .Sh STANDARDS
 The
 .Fn fflush
Index: libc/stdio/funopen.3
===================================================================
RCS file: /cvs/src/lib/libc/stdio/funopen.3,v
retrieving revision 1.17
diff -u -p -r1.17 funopen.3
--- libc/stdio/funopen.3        13 Jan 2015 14:02:30 -0000      1.17
+++ libc/stdio/funopen.3        4 Nov 2015 20:28:56 -0000
@@ -148,7 +148,7 @@ for any of the errors specified for the 
 .Xr fclose 3 ,
 .Xr fopen 3 ,
 .Xr fseek 3 ,
-.Xr setbuf 3
+.Xr setvbuf 3
 .Sh HISTORY
 The
 .Fn funopen
Index: lib/libpthread/socket/1/socket1.c
===================================================================
RCS file: /cvs/src/regress/lib/libpthread/socket/1/socket1.c,v
retrieving revision 1.3
diff -u -p -r1.3 socket1.c
--- lib/libpthread/socket/1/socket1.c   5 Jan 2006 03:47:19 -0000       1.3
+++ lib/libpthread/socket/1/socket1.c   4 Nov 2015 20:29:53 -0000
@@ -176,8 +176,8 @@ main(int argc, char *argv[])
 {
        pthread_t thread;
 
-       setbuf(stdout, NULL);
-       setbuf(stderr, NULL);
+       setvbuf(stdout, NULL, _IONBUF, 0);
+       setvbuf(stderr, NULL, _IONBUF, 0);
 
        CHECKr(pthread_attr_init(&attr));
 #if 0
Index: lib/libpthread/socket/2/socket2.c
===================================================================
RCS file: /cvs/src/regress/lib/libpthread/socket/2/socket2.c,v
retrieving revision 1.6
diff -u -p -r1.6 socket2.c
--- lib/libpthread/socket/2/socket2.c   30 Oct 2005 23:59:43 -0000      1.6
+++ lib/libpthread/socket/2/socket2.c   4 Nov 2015 20:29:53 -0000
@@ -177,8 +177,8 @@ main(int argc, char *argv[])
 {
        pthread_t thread;
 
-       setbuf(stdout, NULL);
-       setbuf(stderr, NULL);
+       setvbuf(stdout, NULL, _IONBF, 0);
+       setvbuf(stderr, NULL, _IONBF, 0);
 
        CHECKr(pthread_create(&thread, NULL, sock_accept, 
            (void *)0xdeadbeaf));
Index: lib/libpthread/socket/2a/socket2a.c
===================================================================
RCS file: /cvs/src/regress/lib/libpthread/socket/2a/socket2a.c,v
retrieving revision 1.4
diff -u -p -r1.4 socket2a.c
--- lib/libpthread/socket/2a/socket2a.c 31 Jul 2003 21:48:06 -0000      1.4
+++ lib/libpthread/socket/2a/socket2a.c 4 Nov 2015 20:29:53 -0000
@@ -100,8 +100,8 @@ main(int argc, char *argv[])
 
        if (argc == 3 && (!strcmp(argv[1], "fork okay"))) {
                sleep(1);
-               setbuf(stdout, NULL);
-               setbuf(stderr, NULL);
+               setvbuf(stdout, NULL, _IONBF, 0);
+               setvbuf(stderr, NULL, _IONBF, 0);
 
                CHECKr(pthread_create(&thread, NULL, sock_connect, 
                    (void *)argv[2]));
Index: usr.sbin/syslogd/ttylog.c
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/ttylog.c,v
retrieving revision 1.2
diff -u -p -r1.2 ttylog.c
--- usr.sbin/syslogd/ttylog.c   23 Oct 2015 14:06:55 -0000      1.2
+++ usr.sbin/syslogd/ttylog.c   4 Nov 2015 20:29:54 -0000
@@ -68,7 +68,7 @@ main(int argc, char *argv[])
 
        if ((lg = fopen(logfile, "w")) == NULL)
                err(1, "fopen %s", logfile);
-       if (setlinebuf(lg) != 0)
+       if (setvbuf(lg, NULL, _IOLBF, 0) != 0)
                err(1, "setlinebuf");
 
        memset(&act, 0, sizeof(act));

Reply via email to