tcgetsize() / ioctl(TIOCGWINSZ) bug

Looks like in some situations it works fine but in some it just fills
rows and cols parameters with zeroes, although it always return 0. The
ioctl(TIOCGWINSZ) exhibits the same behavior and I guess it is used by
tcgetsize anyway. In all cases isatty() returns TRUE.

Examples of sizes returned by attached code in various environments:

  1. QNX → telnet to QNX: returns 0 size 25:80
  2. Windows → direct serial connection to QNX (using Kermit95): returns
    0 size 0:0
  3. QNX → telnet to Sun → telnet to QNX: returns 0 size 0:0
  4. Solaris → telnet to Sun → telnet to Sun: returns EINVAL

If you ask me, I’d prefer Solaris behavior. It is not good to return
success and fill bogus data.

  • Igor