bin/78692: [PATCH] add support for line buffered output to sed(1)
Eugene Grosbein
eugen at kuzbass.ru
Fri Mar 11 03:40:04 PST 2005
>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 at 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:
More information about the freebsd-bugs
mailing list