From owner-svn-src-all@FreeBSD.ORG Tue May 8 16:36:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5E82A1065673; Tue, 8 May 2012 16:36:33 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 487CC8FC12; Tue, 8 May 2012 16:36:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q48GaXxP043644; Tue, 8 May 2012 16:36:33 GMT (envelope-from jlh@svn.freebsd.org) Received: (from jlh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q48GaXBb043637; Tue, 8 May 2012 16:36:33 GMT (envelope-from jlh@svn.freebsd.org) Message-Id: <201205081636.q48GaXBb043637@svn.freebsd.org> From: Jeremie Le Hen Date: Tue, 8 May 2012 16:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235139 - in stable/9: lib lib/libc/stdio lib/libstdbuf usr.bin usr.bin/stdbuf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2012 16:36:33 -0000 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; }