Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Jun 2014 01:06:02 -0500
From:      Pedro Giffuni <pfg@freebsd.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r267692 - head/usr.bin/sed
Message-ID:  <BE9F2DB0-5C97-41DA-853E-F01BA39D3319@freebsd.org>
In-Reply-To: <20140621054744.GN3991@kib.kiev.ua>
References:  <201406202141.s5KLfU2J047433@svn.freebsd.org> <20140621054744.GN3991@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

Il giorno 21/giu/2014, alle ore 00:47, Konstantin Belousov =
<kostikbel@gmail.com> ha scritto:

> On Fri, Jun 20, 2014 at 09:41:30PM +0000, Pedro F. Giffuni wrote:
>> Author: pfg
>> Date: Fri Jun 20 21:41:30 2014
>> New Revision: 267692
>> URL: http://svnweb.freebsd.org/changeset/base/267692
>>=20
>> Log:
>>  Add -u (unbuffered output) after GNU sed.
>>=20
>>  Obtained from:	NetBSD
>>  MFC after:	1 week
>>=20
>> Modified:
>>  head/usr.bin/sed/main.c
>>  head/usr.bin/sed/sed.1
>>=20
>> Modified: head/usr.bin/sed/main.c
>> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
>> --- head/usr.bin/sed/main.c	Fri Jun 20 21:35:39 2014	=
(r267691)
>> +++ head/usr.bin/sed/main.c	Fri Jun 20 21:41:30 2014	=
(r267692)
>> @@ -132,7 +132,7 @@ main(int argc, char *argv[])
>> 	fflag =3D 0;
>> 	inplace =3D NULL;
>>=20
>> -	while ((c =3D getopt(argc, argv, "EI:ae:f:i:lnr")) !=3D -1)
>> +	while ((c =3D getopt(argc, argv, "EI:ae:f:i:lnru")) !=3D -1)
>> 		switch (c) {
>> 		case 'r':		/* Gnu sed compat */
>> 		case 'E':
>> @@ -168,6 +168,16 @@ main(int argc, char *argv[])
>> 		case 'n':
>> 			nflag =3D 1;
>> 			break;
>> +		case 'u':
>> +#ifdef _IONBF
>> +			c =3D setvbuf(stdout, NULL, _IONBF, 0);
>> +#else
>> +			c =3D -1;
>> +			errno =3D EOPNOTSUPP;
>> +#endif
>> +			if (c)
>=20
> Why doing it that way ? IMO the conditional is useless and even wrong.
> FreeBSD provides the _IONBF, _IONBF is required by C99.
>=20
> If some other system lacks _IONBF, it should get compiler error =
instead
> of silently accepting non-working code.

I was just trying to keep the code somewhat in sync with NetBSD: as of =
lately their emphasis is portability and for them it=92s important to be =
build all their system in weird platforms.

I agree it=92s ugly though, so unless someone thinks we should care I =
will clean it up :).

Pedro.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BE9F2DB0-5C97-41DA-853E-F01BA39D3319>