richr@ai.etl.army.mil (Richard Rosenthal) (03/11/89)
How does "more" program know how many lines in 4Sight window? Apparently not from termcap ... iris-ansii says 40 lines, but, if I shrink the window to only 4 or 5 lines more still works fine. I want to make "less" work like this, too. "less" seems to only use termcap. Any answers? -Rich -- Richard Rosenthal Internet: richr@ai.etl.army.mil Engineer Topographic Labs UUCP: ...!ames!ai.etl.army.mil!richr Ft. Belvoir, VA 22060-5546 BITNET: richr%ai.etl.army.mil@CUNYVM +1 202 355 3653 CSNET: richr%ai.etl.army.mil@RELAY.CS.NET
jmb@patton.SGI.COM (Jim Barton) (03/11/89)
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' --
msc@ramoth.SGI.COM (Mark Callow) (03/12/89)
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? > > Apparently not from termcap ... iris-ansii says 40 lines, but, > if I shrink the window to only 4 or 5 lines more still works > fine. > > I want to make "less" work like this, too. "less" seems to only > use termcap. > wsh sets the size in the kernel using the bsd TIOCSWINSZ ioctl. Terminfo and curses retrieve this information using the TIOCGWINSZ ioctl. Any program using curses or terminfo (e.g. more, ls, vi) works quite well. The version of less that I'm using works just fine. The algorithm in terminfo is as follows: set lines and columns from terminfo database if (TIOCGWINSZ) override lines and columns with ioctl data if (getenv(LINES)) override lines with environment value if (getenv(COLUMNS)) override columns with environment value We don't have termcap on the 4D (other than the libtermcap emulation provided by terminfo) so either you are on a 3xxx or you've provided your own termcap. For the 3xxx simply replace terminfo with termcap in the above algorithm. -- -Mark
rpaul@dasys1.UUCP (Rod Paul) (03/13/89)
Seems you may have an old version of "less", let me know what version you have and I've got a later one I'll pass it on. If you're running a 4D series with v 2.0, 2.2 or 3.1 you can hack /bin/man (or is it /usr/bin/man ?), anyway you can plug in "less" , it even handles ^Z on the new OS.
eap@bu-cs.BU.EDU (Eric Pearce) (03/16/89)
In article <262@ai.etl.army.mil> richr@ai.etl.army.mil. (Richard Rosenthal) says: >How does "more" program know how many lines in 4Sight window? > >Apparently not from termcap ... iris-ansii says 40 lines, but, >if I shrink the window to only 4 or 5 lines more still works >fine. > >I want to make "less" work like this, too. "less" seems to only >use termcap. I have a version of less (version 61) and it has support for both termcap + terminfo and other differences between BSD and SYSV. I had better luck compiling it with the SYSV defines (on an IRIS personal). You should be able to get it at any decent archive site, if not, I can mail it to you. -e -- ------------------------------------------------------------------------------- Eric Pearce ARPANET eap@bu-it.bu.edu Boston University Information Technology CSNET eap%bu-it@bu-cs 111 Cummington Street JNET jnet%"ep@buenga" Boston MA 02215 UUCP !harvard!bu-cs!bu-it!eap 617-353-2780 voice 617-353-6260 fax BITNET ep@buenga