Add -u (unbuffered output) after GNU sed.
Obtained from: NetBSD MFC after: 1 week
This commit is contained in:
parent
a2e4bd70ec
commit
fc39ce9ee1
@ -132,7 +132,7 @@ main(int argc, char *argv[])
|
||||
fflag = 0;
|
||||
inplace = NULL;
|
||||
|
||||
while ((c = getopt(argc, argv, "EI:ae:f:i:lnr")) != -1)
|
||||
while ((c = getopt(argc, argv, "EI:ae:f:i:lnru")) != -1)
|
||||
switch (c) {
|
||||
case 'r': /* Gnu sed compat */
|
||||
case 'E':
|
||||
@ -168,6 +168,16 @@ main(int argc, char *argv[])
|
||||
case 'n':
|
||||
nflag = 1;
|
||||
break;
|
||||
case 'u':
|
||||
#ifdef _IONBF
|
||||
c = setvbuf(stdout, NULL, _IONBF, 0);
|
||||
#else
|
||||
c = -1;
|
||||
errno = EOPNOTSUPP;
|
||||
#endif
|
||||
if (c)
|
||||
warnx("setting unbuffered output failed");
|
||||
break;
|
||||
default:
|
||||
case '?':
|
||||
usage();
|
||||
@ -199,9 +209,10 @@ main(int argc, char *argv[])
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr, "%s\n%s\n",
|
||||
"usage: sed script [-Ealn] [-i extension] [file ...]",
|
||||
" sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]");
|
||||
(void)fprintf(stderr,
|
||||
"usage: %s script [-Ealnru] [-i[<extension>]] [file ...]\n"
|
||||
"\t%s [-Ealnu] [-i[<extension>]] [-e script] ... [-f script_file]"
|
||||
" ... [file ...]\n", getprogname(), getprogname());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
.\" @(#)sed.1 8.2 (Berkeley) 12/30/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 9, 2013
|
||||
.Dd June 20, 2014
|
||||
.Dt SED 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -39,7 +39,7 @@
|
||||
.Nd stream editor
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl Ealnr
|
||||
.Op Fl Ealnru
|
||||
.Ar command
|
||||
.Op Ar
|
||||
.Nm
|
||||
@ -148,6 +148,8 @@ option suppresses this behavior.
|
||||
Same as
|
||||
.Fl E
|
||||
for compatibility with GNU sed.
|
||||
.It Fl u
|
||||
Make output unbuffered.
|
||||
.El
|
||||
.Pp
|
||||
The form of a
|
||||
|
Loading…
Reference in New Issue
Block a user