From owner-freebsd-bugs@FreeBSD.ORG Fri Mar 11 11:40:04 2005 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E247716A4CE for ; Fri, 11 Mar 2005 11:40:03 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 647DC43D58 for ; Fri, 11 Mar 2005 11:40:03 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j2BBe38V053390 for ; Fri, 11 Mar 2005 11:40:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j2BBe3N7053388; Fri, 11 Mar 2005 11:40:03 GMT (envelope-from gnats) Resent-Date: Fri, 11 Mar 2005 11:40:03 GMT Resent-Message-Id: <200503111140.j2BBe3N7053388@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Eugene Grosbein Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4E91B16A4CE for ; Fri, 11 Mar 2005 11:31:11 +0000 (GMT) Received: from www.svzserv.kemerovo.su (www.svzserv.kemerovo.su [213.184.65.80]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0AB2343D2F for ; Fri, 11 Mar 2005 11:31:10 +0000 (GMT) (envelope-from eu@www.svzserv.kemerovo.su) Received: from www.svzserv.kemerovo.su (smmsp@localhost [127.0.0.1]) j2BBV72k079057 for ; Fri, 11 Mar 2005 18:31:07 +0700 (KRAT) (envelope-from eu@www.svzserv.kemerovo.su) Received: (from root@localhost) by www.svzserv.kemerovo.su (8.12.11/8.12.11/Submit) id j2BBV7Rq079056; Fri, 11 Mar 2005 18:31:07 +0700 (KRAT) (envelope-from eu) Message-Id: <200503111131.j2BBV7Rq079056@www.svzserv.kemerovo.su> Date: Fri, 11 Mar 2005 18:31:07 +0700 (KRAT) From: Eugene Grosbein To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/78692: [PATCH] add support for line buffered output to sed(1) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Mar 2005 11:40:04 -0000 >Number: 78692 >Category: bin >Synopsis: [PATCH] add support for line buffered output to sed(1) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Mar 11 11:40:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Eugene Grosbein >Release: FreeBSD 4.10-STABLE i386 >Organization: Svyaz Service JSC >Environment: System: FreeBSD www.svzserv.kemerovo.su 4.10-STABLE FreeBSD 4.10-STABLE #1: Thu Jun 17 13:32:02 KRAST 2004 eu@www.svzserv.kemerovo.su:/home4/obj/home/src/sys/WWW i386 >Description: The following patch introduces new command line option -l for sed(1) that makes its output stream line buffered. This makes it possible to use sed(1) for realtime text processing that is sometimes need. For example, syslog.conf(5) can pipe messages to a command that uses sed(1) to process its input. Then the stream volume is low, it may take hours to get an output from sed(1) currently. >How-To-Repeat: See description. >Fix: 'sed -l' uses line buffered output --- usr.bin/sed/main.c.orig Fri Mar 11 18:07:14 2005 +++ usr.bin/sed/main.c Fri Mar 11 18:11:30 2005 @@ -128,7 +128,7 @@ fflag = 0; inplace = NULL; - while ((c = getopt(argc, argv, "Eae:f:i:n")) != -1) + while ((c = getopt(argc, argv, "Eae:f:i:ln")) != -1) switch (c) { case 'E': rflags = REG_EXTENDED; @@ -151,6 +151,9 @@ case 'i': inplace = optarg; break; + case 'l': + if(setlinebuf(stdout) != 0) + warnx("setlinebuf: the request cannot be honored"); case 'n': nflag = 1; break; --- usr.bin/sed/sed.1.orig Fri Mar 11 18:27:47 2005 +++ usr.bin/sed/sed.1 Fri Mar 11 18:29:37 2005 @@ -43,11 +43,11 @@ .Nd stream editor .Sh SYNOPSIS .Nm -.Op Fl Ean +.Op Fl Ealn .Ar command .Op Ar .Nm -.Op Fl Ean +.Op Fl Ealn .Op Fl e Ar command .Op Fl f Ar command_file .Op Fl i Ar extension @@ -109,6 +109,8 @@ .Ar extension when in-place editing files, as you risk corruption or partial content in situations where disk space is exhausted, etc. +.It Fl l +Make stdout line buffered. .It Fl n By default, each line of input is echoed to the standard output after all of the commands have been applied to it. >Release-Note: >Audit-Trail: >Unformatted: