Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Peter Neilley <neilley@ucar.edu>
Subject: How to get the terminal size?
Date: 1997/06/19	[thread overview]
Message-ID: <33A9C031.288D015F@ucar.edu> (raw)


<HTML>
Newbie here... I'm porting code developed on a SunOS/Solaris/IRIX/HP/Ultrix/LINUX,
etc. platforms
<BR>to a Digital Unix machine.&nbsp; I&nbsp;need to know how to get the
current terminal size (rows/columns)
<BR>without having to resort to using the curses lib.&nbsp; On the previous
systems I&nbsp;used an ioctl call (see below),
<BR>but this doesn't seem to be supported under Digital Unix.&nbsp; I'm
working very remotely from the machine
<BR>(and manuals)&nbsp;so if&nbsp; someone could help, I'd appreciate it.
<BR>----------------------
<BR>Elements of code for getting terminal size that doesn't seem to be
supported on Digital Unix:

<P>struct winsiz WINSIZ;
<BR>int TERM_FD;
<BR>.
<BR>.
<BR>if (&nbsp;TERM_FD = open("/dev/tty",O_RDWR)&nbsp;......
<BR>.
<BR>.
<BR>if (&nbsp;ioctl(TERM_FD,TIOCGWINSZ,&amp;WINSIZ)&nbsp;== 0 )
<BR>&nbsp; {
<BR>&nbsp;&nbsp; *lines = WINSIZ.ws_row;
<BR>&nbsp;&nbsp; *cols = WINSIZ.ws_col;
<BR>.
<BR>.
<BR>
<PRE>&nbsp;
--&nbsp;
Peter Neilley, NCAR/RAP
neilley@ucar.edu</PRE>
</HTML>




                 reply	other threads:[~1997-06-19  4:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox