Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sgi!jmb@patton.SGI.COM From: jmb@patton.SGI.COM (Jim Barton) Newsgroups: comp.sys.sgi Subject: Re: Lines per Window Summary: Two solutions Message-ID: <28477@sgi.SGI.COM> Date: 11 Mar 89 00:41:17 GMT References: <262@ai.etl.army.mil> Sender: daemon@sgi.SGI.COM Distribution: usa Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 28 In article <262@ai.etl.army.mil>, richr@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@sgi.sgi.com, sgi!jmb@decwrl.dec.com, ...{decwrl,sun}!sgi!jmb "I used to be disgusted, now I'm just amused." - Elvis Costello, 'Red Shoes' --