From owner-svn-src-head@FreeBSD.ORG Fri Jun 20 21:41:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1C527D56; Fri, 20 Jun 2014 21:41:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E498A2DF0; Fri, 20 Jun 2014 21:41:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5KLfUC0047435; Fri, 20 Jun 2014 21:41:30 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5KLfU2J047433; Fri, 20 Jun 2014 21:41:30 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201406202141.s5KLfU2J047433@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 20 Jun 2014 21:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267692 - head/usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2014 21:41:31 -0000 Author: pfg Date: Fri Jun 20 21:41:30 2014 New Revision: 267692 URL: http://svnweb.freebsd.org/changeset/base/267692 Log: Add -u (unbuffered output) after GNU sed. Obtained from: NetBSD MFC after: 1 week Modified: head/usr.bin/sed/main.c head/usr.bin/sed/sed.1 Modified: head/usr.bin/sed/main.c ============================================================================== --- head/usr.bin/sed/main.c Fri Jun 20 21:35:39 2014 (r267691) +++ head/usr.bin/sed/main.c Fri Jun 20 21:41:30 2014 (r267692) @@ -132,7 +132,7 @@ main(int argc, char *argv[]) fflag = 0; inplace = NULL; - while ((c = getopt(argc, argv, "EI:ae:f:i:lnr")) != -1) + while ((c = getopt(argc, argv, "EI:ae:f:i:lnru")) != -1) switch (c) { case 'r': /* Gnu sed compat */ case 'E': @@ -168,6 +168,16 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; + case 'u': +#ifdef _IONBF + c = setvbuf(stdout, NULL, _IONBF, 0); +#else + c = -1; + errno = EOPNOTSUPP; +#endif + if (c) + warnx("setting unbuffered output failed"); + break; default: case '?': usage(); @@ -199,9 +209,10 @@ main(int argc, char *argv[]) static void usage(void) { - (void)fprintf(stderr, "%s\n%s\n", - "usage: sed script [-Ealn] [-i extension] [file ...]", - " sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]"); + (void)fprintf(stderr, + "usage: %s script [-Ealnru] [-i[]] [file ...]\n" + "\t%s [-Ealnu] [-i[]] [-e script] ... [-f script_file]" + " ... [file ...]\n", getprogname(), getprogname()); exit(1); } Modified: head/usr.bin/sed/sed.1 ============================================================================== --- head/usr.bin/sed/sed.1 Fri Jun 20 21:35:39 2014 (r267691) +++ head/usr.bin/sed/sed.1 Fri Jun 20 21:41:30 2014 (r267692) @@ -31,7 +31,7 @@ .\" @(#)sed.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd December 9, 2013 +.Dd June 20, 2014 .Dt SED 1 .Os .Sh NAME @@ -39,7 +39,7 @@ .Nd stream editor .Sh SYNOPSIS .Nm -.Op Fl Ealnr +.Op Fl Ealnru .Ar command .Op Ar .Nm @@ -148,6 +148,8 @@ option suppresses this behavior. Same as .Fl E for compatibility with GNU sed. +.It Fl u +Make output unbuffered. .El .Pp The form of a