svn commit: r235139 - in stable/9: lib lib/libc/stdio lib/libstdbuf usr.bin usr.bin/stdbuf

Jeremie Le Hen jlh at FreeBSD.org
Tue May 8 16:36:33 UTC 2012


Author: jlh
Date: Tue May  8 16:36:32 2012
New Revision: 235139
URL: http://svn.freebsd.org/changeset/base/235139

Log:
  MFC r234772:
    Import stdbuf(1) and the shared library it relies on.
    This tool changes the default buffering behaviour of standard
    stdio streams.
  
    It only works on dynamic binaries.  To make it work for static
    ones it would require cluttering stdio because there no single
    entry point.
  
    PR:		166660
    Reviewed by:	current@, jhb
    Approved by:	kib (mentor)
    MFC after:	1 week
  
  MFC r234773:
    Fix small documentation mistakes.
  
    Submitted by:	brueffer
    Approved by:	kib (mentor)
  
  MFC r234779:
    Use standard getopt(3) error message.
  
    Submitted by:	jilles
    Approved by:	kib (mentor)

Added:
     - copied from r234772, head/lib/libstdbuf/
     - copied from r234772, head/usr.bin/stdbuf/
Directory Properties:
  stable/9/lib/libstdbuf/   (props changed)
  stable/9/usr.bin/stdbuf/   (props changed)
Modified:
  stable/9/lib/Makefile
  stable/9/lib/libc/stdio/setbuf.3
  stable/9/lib/libstdbuf/libstdbuf.3
  stable/9/usr.bin/Makefile
  stable/9/usr.bin/stdbuf/stdbuf.c
Directory Properties:
  stable/9/lib/   (props changed)
  stable/9/lib/libc/   (props changed)
  stable/9/usr.bin/   (props changed)

Modified: stable/9/lib/Makefile
==============================================================================
--- stable/9/lib/Makefile	Tue May  8 15:18:35 2012	(r235138)
+++ stable/9/lib/Makefile	Tue May  8 16:36:32 2012	(r235139)
@@ -100,6 +100,7 @@ SUBDIR=	${SUBDIR_ORDERED} \
 	${_libsmdb} \
 	${_libsmutil} \
 	libstand \
+	libstdbuf \
 	${_libtelnet} \
 	${_libthr} \
 	libthread_db \

Modified: stable/9/lib/libc/stdio/setbuf.3
==============================================================================
--- stable/9/lib/libc/stdio/setbuf.3	Tue May  8 15:18:35 2012	(r235138)
+++ stable/9/lib/libc/stdio/setbuf.3	Tue May  8 16:36:32 2012	(r235139)
@@ -83,6 +83,9 @@ normally does) it is line buffered.
 The standard error stream
 .Dv stderr
 is always unbuffered.
+Note that these defaults may be altered using the
+.Xr stdbuf 1
+utility.
 .Pp
 The
 .Fn setvbuf
@@ -177,6 +180,7 @@ function returns what the equivalent
 .Fn setvbuf
 would have returned.
 .Sh SEE ALSO
+.Xr stdbuf 1 ,
 .Xr fclose 3 ,
 .Xr fopen 3 ,
 .Xr fread 3 ,

Modified: stable/9/lib/libstdbuf/libstdbuf.3
==============================================================================
--- head/lib/libstdbuf/libstdbuf.3	Sat Apr 28 20:52:20 2012	(r234772)
+++ stable/9/lib/libstdbuf/libstdbuf.3	Tue May  8 16:36:32 2012	(r235139)
@@ -43,7 +43,7 @@ an utility,
 .Xr stdbuf 1 ,
 can be used to run a command with the appropriate environment variables.
 .Sh ENVIRONMENT
-Each stream can be configured indepentently through the following
+Each stream can be configured independently through the following
 environment variables (values are defined below):
 .Bl -tag -width size -offset indent
 .It Ev _STDBUF_I

Modified: stable/9/usr.bin/Makefile
==============================================================================
--- stable/9/usr.bin/Makefile	Tue May  8 15:18:35 2012	(r235138)
+++ stable/9/usr.bin/Makefile	Tue May  8 16:36:32 2012	(r235139)
@@ -143,6 +143,7 @@ SUBDIR=	alias \
 	sockstat \
 	split \
 	stat \
+	stdbuf \
 	su \
 	systat \
 	tabs \

Modified: stable/9/usr.bin/stdbuf/stdbuf.c
==============================================================================
--- head/usr.bin/stdbuf/stdbuf.c	Sat Apr 28 20:52:20 2012	(r234772)
+++ stable/9/usr.bin/stdbuf/stdbuf.c	Tue May  8 16:36:32 2012	(r235139)
@@ -52,7 +52,7 @@ main(int argc, char *argv[])
 	int i;
 
 	ibuf = obuf = ebuf = NULL;
-	while ((i = getopt(argc, argv, ":e:i:o:")) != -1) {
+	while ((i = getopt(argc, argv, "e:i:o:")) != -1) {
 		switch (i) {
 		case 'e':
 			ebuf = optarg;
@@ -63,13 +63,8 @@ main(int argc, char *argv[])
 		case 'o':
 			obuf = optarg;
 			break;
-		case ':':
-			warnx("Missing argument for option -%c", optopt);
-			usage(1);
-			break;
 		case '?':
 		default:
-			warnx("Unknown option: %c", optopt);
 			usage(1);
 			break;
 		}


More information about the svn-src-stable-9 mailing list