Karim Belabas on Sun, 15 Dec 2013 12:13:11 +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-15 00:38]: > We also need 'struct winsize' but it should be in the same header file. > > Apparently TIOCGWINSZ was defined in sys/termios.h in some SunOS system which > did not carry termios.h. Here's the precise reference: http://www.manpages.info/sunos/termio.7.html [...] Terminal Size The number of lines and columns on the terminal's display is specified in the winsize structure defined by sys/termios.h and includes the following members: unsigned short ws_row; /* rows, in characters */ unsigned short ws_col; /* columns, in characters */ I also found this bug report (for Taskwarrior): http://taskwarrior.org/issues/785 from 2011 so it's not that obscure: [...] I had to modify interactive.cpp to #include sys/termios.h to get access to TIOCGWINSZ. sys/ioctl.h and sys/termios.h are in the SUNWhea package [...] I'm assuming that TIOCGWINSZ is defined in sys/ioctl.h on other platforms. $ uname -a SunOS <hostname_snipped> 5.10 Generic_127127-11 sun4u sparc SUNW,Sun-Blade-1500 [...] I found the sys/termios.h header file here: http://www.ualberta.ca/dept/aict/uts/software/solaris9/sparc/patches/solaris/9_Recommended/122300-28/SUNWhea/reloc/usr/include/sys/termios.h which indeed defines both TIOCGWINSZ and struct winsize *unless* one of _POSIX_C_SOURCE _XOPEN_SOURCE is defined. It does not declare the function 'ioctl()' itself, though. I also found older reports on Cygwin http://www.zsh.org/mla/workers/2005/msg00899.html which implies that [some time ago] Cygwin defined 'TIOCGWINSZ' in <termios.h> and declared 'ioctl()' in <sys/ioctl.h>. I checked in recent versions: now (since 2006) <sys/ioctl.h> includes <sys/termios.h> which contains the needed stuff. (And prior versions will indeed fail.) OK, I'll go for #ifdef __sun # include <sys/termios.h> #endif #include <sys/ioctl.h> Thanks for the discussion ! 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] `