Karim Belabas on Sun, 08 Dec 2013 15:56:32 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: small patch for src/languages/es.c


* Bill Allombert [2013-12-08 14:12]:
> On Sun, Dec 08, 2013 at 12:44:08AM -0500, Eitan Adler wrote:
>> commit e16f45f601c8e9afc03157c5659ce8213d05b83a
>> Author: Eitan Adler <lists@eitanadler.com>
>> Date:   Sun Dec 8 00:33:06 2013 -0500
>> 
>>     termios.h should be found in the root of the include path, not in
>>     $INCLUDE_PATH/sys
> 
> What is the rationale for the change? You should state what you want to
> achieve.

> Your patch is not correct since you did not change config/has_TIOCGWINSZ.c to
> match.

(My commit changes both.)

> As far as I can see POSIX indeed requires #include <termios.h>. However 
> POSIX does not seem to mention TIOCGWINSZ, and I do not know any system which
> have TIOCGWINSZ but where #include <sys/termios.h> does not work.

I had stopped at POSIX requirement, a little googling that implied
that at least some versions of the Android NDK don't have <sys/termios.h>,
and a quick check at how GNU less did it.

It seems some various versions of Solaris used to require <sys/termios.h>,
but I could not confirm this. ( It also seems that a few broken systems
out there don't allow including both <sys/ioctl.h> and <termios.h> )

I decided to go with the modern standard, since this is a minor point
anyway: the penalty for doing it wrong -- and not being able to read
terminal size -- is that we default to a 20 x 80 terminal, which should
be OK for almost users.


In principle, the #include <termios.h> could be dispensed with entirely,
but it's hard to predict where 'TIOCGWINSZ' and 'struct winsize' will be
defined, and 'ioctl()' declared (usually all 3 in  <sys/ioctl.h>). I am
not sure whether including <termios.h> makes the code more, or less,
portable. I guess we'll wait until somebody reports an actual problem,
then beef up the relevant Configure check...

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`