diff --git a/appl/telnet/telnet/sys_bsd.c b/appl/telnet/telnet/sys_bsd.c index 3071afeb6..9af2d1c51 100644 --- a/appl/telnet/telnet/sys_bsd.c +++ b/appl/telnet/telnet/sys_bsd.c @@ -44,16 +44,28 @@ RCSID("$Id$"); */ +#ifdef HAVE_FCNTL_H #include +#endif +#ifdef HAVE_SYS_TYPES_H #include +#endif #ifdef HAVE_SYS_SELECT_H #include #endif +#ifdef HAVE_SYS_TIME_H #include +#endif +#ifdef HAVE_SYS_SOCKET_H #include +#endif #include #include +#ifdef HAVE_ARPA_TELNET_H #include +#endif + +#include #include "ring.h" @@ -644,16 +656,14 @@ TerminalSpeeds(ispeed, ospeed) TerminalWindowSize(rows, cols) long *rows, *cols; { -#ifdef TIOCGWINSZ struct winsize ws; - if (ioctl(fileno(stdin), TIOCGWINSZ, (char *)&ws) >= 0) { + if (get_window_size (STDIN_FILENO, &ws) == 0) { *rows = ws.ws_row; *cols = ws.ws_col; return 1; - } -#endif /* TIOCGWINSZ */ - return 0; + } else + return 0; } int