Use `get_window_size'

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1163 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-01-15 21:16:58 +00:00
parent 5a8b401dcb
commit 7f1466fea9

View File

@@ -44,16 +44,28 @@ RCSID("$Id$");
*/ */
#ifdef HAVE_FCNTL_H
#include <fcntl.h> #include <fcntl.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#ifdef HAVE_ARPA_TELNET_H
#include <arpa/telnet.h> #include <arpa/telnet.h>
#endif
#include <roken.h>
#include "ring.h" #include "ring.h"
@@ -644,15 +656,13 @@ TerminalSpeeds(ispeed, ospeed)
TerminalWindowSize(rows, cols) TerminalWindowSize(rows, cols)
long *rows, *cols; long *rows, *cols;
{ {
#ifdef TIOCGWINSZ
struct winsize ws; struct winsize ws;
if (ioctl(fileno(stdin), TIOCGWINSZ, (char *)&ws) >= 0) { if (get_window_size (STDIN_FILENO, &ws) == 0) {
*rows = ws.ws_row; *rows = ws.ws_row;
*cols = ws.ws_col; *cols = ws.ws_col;
return 1; return 1;
} } else
#endif /* TIOCGWINSZ */
return 0; return 0;
} }