scf@statware.UUCP (Steve Fullerton) (11/29/90)
I have been trying to get the following code to work for SCO UNIX:
#include <errno.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stream.h>
#include <sys/ptem.h>
main()
{
struct winsize xwin;
if (ioctl(0, TIOCGWINSZ, &xwin) == 0)
printf("Window size: %d x %d\n",xwin.ws_row,xwin.ws_col);
else
printf("errno = %d\n",errno);
}
So far all I get is an errno of 22. This code works fine on many other
systems (different include files though) such as Sun, HP, IBM RS/6000,
DG AViiON, etc. If anyone has managed to get this call to work for
SCO UNIX, I would appreciate learning how. BTW, I have SCO UNIX System V/386
3.2 Version 2.0.
--
Steve Fullerton Statware, Inc.
scf%statware.uucp@cs.orst.edu 260 SW Madison Ave, Suite 109
orstcs!statware!scf Corvallis, OR 97333
503/753-5382
guy@auspex.auspex.com (Guy Harris) (12/05/90)
> if (ioctl(0, TIOCGWINSZ, &xwin) == 0) ... >So far all I get is an errno of 22. *Sigh* time for another "egrep", 'cuz I sure haven't memorized the UNIX error numbers: auspex% egrep 22 /usr/include/sys/errno.h #define EINVAL 22 /* Invalid argument */ OK, there we go. EINVAL on an "ioctl()" call tends to indicate that the object on which you did the "ioctl()" doesn't support it. S5R3-ish systems *tend* not to support it on anything other than pseudo-ttys; are you doing this on a pseudo-tty, or on a real terminal (or perhaps on a "virtual terminal" or whatever the multiscreen thingies on 386 UNIXes are called)? If not, you may be stuck. >This code works fine on many other systems (different include files >though) such as Sun, HP, IBM RS/6000, DG AViiON, etc. Most of those systems probably adopted TIOCGWINSZ from BSD; you may also be using a window system terminal emulator or a remote login on those systems, in which case you'd probably be on a pseudo-tty. BSD didn't restrict TIOCGWINSZ to pseudo-ttys.