summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-05-10 13:40:50 +0000
committerglebius <glebius@FreeBSD.org>2005-05-10 13:40:50 +0000
commit7db34cfe43e40b9b1c8d46893c8b257f128b570b (patch)
tree1da6ff05e95f80364243ccacd701d2a23c265798
parenta521f4fbfdded78ae8f8cb02085c252293975ca6 (diff)
downloadFreeBSD-src-7db34cfe43e40b9b1c8d46893c8b257f128b570b.zip
FreeBSD-src-7db34cfe43e40b9b1c8d46893c8b257f128b570b.tar.gz
Add option -l, to make output line buffered.
PR: bin/78692 Submitted by: Eugene Grosbein MFC after: 2 weeks
-rw-r--r--usr.bin/sed/main.c10
-rw-r--r--usr.bin/sed/sed.16
2 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c
index 5528514..5703d20 100644
--- a/usr.bin/sed/main.c
+++ b/usr.bin/sed/main.c
@@ -128,7 +128,7 @@ main(int argc, char *argv[])
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,10 @@ main(int argc, char *argv[])
case 'i':
inplace = optarg;
break;
+ case 'l':
+ if(setlinebuf(stdout) != 0)
+ warnx("setlinebuf() failed");
+ break;
case 'n':
nflag = 1;
break;
@@ -186,8 +190,8 @@ static void
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n",
- "usage: sed script [-Ean] [-i extension] [file ...]",
- " sed [-an] [-i extension] [-e script] ... [-f script_file] ... [file ...]");
+ "usage: sed script [-Ealn] [-i extension] [file ...]",
+ " sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]");
exit(1);
}
diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1
index a21248f..de78443 100644
--- a/usr.bin/sed/sed.1
+++ b/usr.bin/sed/sed.1
@@ -39,11 +39,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
@@ -105,6 +105,8 @@ It is not recommended to give a zero-length
.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 output 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.
OpenPOWER on IntegriCloud