telnet and $LINES
der.hans
PLUG@LuftHans.com
Thu, 28 Sep 2000 17:57:30 -0700 (MST)
Am 28. Sep, 2000 schwäzte Kevin Buettner so:
> Try using Term::Size. (I just glanced at the code in
> Term-Size-0.2.tar.gz and it does the right thing. That is, it queries
> the OS and gets the info back in struct winsize.)
It's going the opposite direction of what I want. I don't need to actually
change the term size, I need to get the far side of the connection to
either realize I'm not really on a terminal or to think that my term size
is bigger than it really is.
> BTW, the shell (some shells anyway) set $LINES based upon the size of
> the xterm (or other terminal window) that it's running in. When you
> resize the window, the shell gets the SIGWINCH signal, it queries the
> size using the TIOCGWINSZ ioctl. The results are returned in struct
> winsize and the shell uses these results to update $LINES and
> $COLUMNS. An application written in C (like ``more'' or an editor)
> can use the same mechanism to adjust itself for the resized window.
> You may want your Perl application to watch for the SIGWINCH signal
> and perform similar adjustments as well.
It looks like Net::Telnet does as well. Looking at the RFCs I found that a
few options affect such. The remote host I'm connecting to is asking to
"DO" "TERMINAL TYPE" and "NAWS" amongst other things. Net::Telnet is
responding with "WONT" to both requests. I haven't gotten it to let me
change that, but I think negotiating NAWS with a large "characters
high" value will work fine.
> A good reference for this type of thing is "Advanced Programming in
> the Unix Environment" by W. Richard Stevens. (I *highly* recommend
> this book.)
I've got it. maybe I'll even get to reading it someday :).
danke,
der.hans
--
# der.hans@LuftHans.com home.pages.de/~lufthans/ www.Opnix.com
# When I work, I work hard. When I play, I play hard.
# When I sit, I sleep. - Embe Kugler