Date: Sat, 21 Jun 2014 08:47:44 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: "Pedro F. Giffuni" <pfg@FreeBSD.org> 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: <20140621054744.GN3991@kib.kiev.ua> In-Reply-To: <201406202141.s5KLfU2J047433@svn.freebsd.org> References: <201406202141.s5KLfU2J047433@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Qf+2chOW7Mplyx0V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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) Why doing it that way ? IMO the conditional is useless and even wrong. FreeBSD provides the _IONBF, _IONBF is required by C99. If some other system lacks _IONBF, it should get compiler error instead of silently accepting non-working code. --Qf+2chOW7Mplyx0V Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJTpRyAAAoJEJDCuSvBvK1BxWUP/2P8sJecoOoysvFOIfuk+tem 19X0b+4607/qNrLaLMBMxlW+LEMBPsUSGPGb6OKf5Z75iZLevAs3fl35DpYSUX8c RqUDHq0ORz+AXFldCZlRFcD0rTpe76vjGFgE5qE16fUuXuweZ9AmVIBU5jn0CrsC +KmD1lULMypw05m15OGttUfJCBvUo9ybOSsUFM65Vy/9RQHEVCrgeKw1i/fO5PqV DB8t3TsnTcohqLa51CH7cG6ceAlBi4tZD0oScgEMr5+HHsRYG95cSjVf4TapV2T+ LwFvDZAMvYnjb3M3TILzwzjLZg0jqwFhASimt/AaJ7GREU4eEnPWJsPRr0MFS53K bK7oHxYuL5BmS+K/g3rkwu1TyJREZtYfqgfZ28fSH9JKaXrbqAS1ZrmSbR1+eMlw nizT6GcI7azw1NnvhfmyTNIByxAczeootcNSI1FHYAYjZWqIxYlZ75omW7LILsvz CjoZjNS+mLvjiG0y3ZJoYmrs3u1GpbR/zuhAemk5UeIeNdX6o/JffbLyULIRAhGl BANT34ip8je1UJdDB1tXmyJMo+LLT2hLvz2Kcd+6rcd9vY45qzMrf/saWkX+OoWU pNOIMX1myQovyjw/7UBO17gCFqqGkYYf2J6HPUNZllZ1kEiUYWeGiOJrdAMnn2/l PBH4g6M3hVVPesPOUig2 =HRIf -----END PGP SIGNATURE----- --Qf+2chOW7Mplyx0V--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140621054744.GN3991>