From owner-freebsd-questions@FreeBSD.ORG Tue Mar 8 15:31:30 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7675716A4CE for ; Tue, 8 Mar 2005 15:31:30 +0000 (GMT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id CB19C43D2F for ; Tue, 8 Mar 2005 15:31:29 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.1) id j28FVSuj090280; Tue, 8 Mar 2005 09:31:28 -0600 (CST) (envelope-from dan) Date: Tue, 8 Mar 2005 09:31:28 -0600 From: Dan Nelson To: Emanuel Strobl Message-ID: <20050308153128.GE37452@dan.emsphone.com> References: <200503080734.46757@harrymail> <20050308072919.GD37452@dan.emsphone.com> <200503080839.58100@harrymail> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200503080839.58100@harrymail> X-OS: FreeBSD 5.3-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.8i cc: freebsd-questions@freebsd.org Subject: Re: ttydX and xterm size (LINES and COLUMNS understanding) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Mar 2005 15:31:30 -0000 In the last episode (Mar 08), Emanuel Strobl said: > Am Dienstag, 8. März 2005 08:29 schrieb Dan Nelson: > > In the last episode (Mar 08), Emanuel Strobl said: > > > When I open a xterm on the local machine, say with 100x37, vi and > > > man recognizes the size and display the content correctly. If I > > > use cu/tip in a 100x37 xterm "ls" works fine (uses all lines) as > > > long as I start vi but man doesn't work (no scrolling possible). > > > After the vi session only 24 lines (or whatever type I set in > > > /etc/ttys) are used, but man works correctly. Why can I use > > > different terminal sizes on the local machine and in ssh sessions > > > but not over a serial console? If I set "setenv LINES 37" and > > > "setenv COLUMNS 100" it works also on the serial line but why or > > > how can vi and others know what size my terminal is via ssh > > > session? I'm sure this behaviour is adoptable to serial consoles > > > too. > > > > Telnet and ssh have out-of-band control sequences that let the > > client pass things like terminal size to the server. There's no > > equivalent > > Where are they set? I can't find any environment variable which > reflect this. It's part of the tty interface (man 4 tty). You can run "stty -a" to see the settings. Forcing a particular screen size can be done with "stty 80 25" for example. > > for serial lines. You can get the screen size from vt100 terminals > > (and many emulators) though, by moving the cursor to the far > > lower-right corner, asking the terminal for the cursor position, > > and reading the result on stdin. > > Even with knwon values I have the problem that when I recall the > previous command in tcsh which was longer than one line there's no > linefeed, the second line overwrites the first line. > > My problem is that I don't really understand how and why different > applications seem to use different methods of displaying text and > determining size values. man, vi and tcsh are at least very > different. Any links highly appreciated. vi seems to look for $LINES and $COLUMNS and will use them instead of the tty's reported size. Most other programs always trust the tty (since they have to trust it anyway to respond to window size changes). -- Dan Nelson dnelson@allantgroup.com