Il giorno 21/giu/2014, alle ore 00:47, Konstantin Belousov 
<kostik...@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
>> 
>> Log:
>>  Add -u (unbuffered output) after GNU sed.
>> 
>>  Obtained from:      NetBSD
>>  MFC after:  1 week
>> 
>> Modified:
>>  head/usr.bin/sed/main.c
>>  head/usr.bin/sed/sed.1
>> 
>> Modified: head/usr.bin/sed/main.c
>> ==============================================================================
>> --- 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 = 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)
> 
> 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.

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

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

Pedro.
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to