summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed/main.c
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 /usr.bin/sed/main.c
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
Diffstat (limited to 'usr.bin/sed/main.c')
-rw-r--r--usr.bin/sed/main.c10
1 files changed, 7 insertions, 3 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);
}
OpenPOWER on IntegriCloud