Add option -l, to make output line buffered.
PR: bin/78692 Submitted by: Eugene Grosbein MFC after: 2 weeks
This commit is contained in:
parent
c26295ddea
commit
1ed86f6c90
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=146055
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user