winsize struct

Chip Salzenberg chip at tct.uucp
Thu Feb 14 01:46:08 AEST 1991


According to scs at adam.mit.edu:
>	#ifdef SIGWINCH
>	#ifdef TIOCSWINSZ

Yup.  Just what the doctor ordered.

>(Of course, figuring out what to #include may be tricky, but here
>it really ought to be <signal.h> and <sgtty.h>, respectively.)

Signal, sure.  But you can't include <sgtty.h> on SCO UNIX, even
though it has TIOCSWINSZ.  Try:

     #if defined(POSIX)
     #include <termios.h>
     #else
     #if defined(USG)
     #include <termio.h>
     #else
     #include <sgtty.h>
     #endif
     #endif

(Macro POSIX and/or USG set from the command line.)

>With a bit of creativity, you can use tricks like these for a
>number of other OS-dependent features.

For future tty mode hacking, I'd like to suggest that all OS-dependent
code be implemented, as much as possible, in terms of POSIX functions
like tcgetattr(), tcsetattr(), tcflush(), etc.
-- 
Chip Salzenberg at Teltronics/TCT     <chip at tct.uucp>, <uunet!pdn!tct!chip>
 "I want to mention that my opinions whether real or not are MY opinions."
             -- the inevitable William "Billy" Steinmetz



More information about the Comp.unix.programmer mailing list