Lines per Window

Jim Barton jmb at patton.SGI.COM
Sat Mar 11 10:41:17 AEST 1989


In article <262 at ai.etl.army.mil>, richr at ai.etl.army.mil (Richard Rosenthal) writes:
> How does "more" program know how many lines in 4Sight window?
> 
...

> -Rich
> 

'more' uses the standard BSD interface of using ioctl with the TIOCGWINSZ
command to get the window size.  It also accepts the SIGWINCH call which 
the system will generate for you if the window is resized (and you ask
for it).  The command and structure returned are described in 
/usr/include/sys/termio.h.

In SysV curses, this can also be done by simply examining the LINES
variable, which contains the current number of lines in the window.

With minor modifications (such as including the right header file), you
should be able to compile 'less' as if it was on a BSD4.3 system (job
control will work as expected too).

-- Jim Barton
Silicon Graphics Computer Systems    "UNIX: Live Free Or Die!"
jmb at sgi.sgi.com, sgi!jmb at decwrl.dec.com, ...{decwrl,sun}!sgi!jmb

  "I used to be disgusted, now I'm just amused."
			- Elvis Costello, 'Red Shoes'
--



More information about the Comp.sys.sgi mailing list