Submit a Story  :  IRAF Links  :  Past Polls  :  Calendar  :  Advanced Search  
     iraf.net
FAQ
 Forum FAQForum FAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

wrong identification of terminal size, bad $ttynlines

 
Post new topic   Reply to topic    iraf.net Forum Index -> Systems
View previous topic :: View next topic  
Author Message
msz1959



Joined: 22 Sep 2009
Posts: 5

PostPosted: Sat Mar 24, 2012 12:00 pm    Post subject: wrong identification of terminal size, bad $ttynlines Reply with quote

I have always had this problem, for decades already, starting on SunOS machines, then Solaris and all sort of Linuxes. It is really strange that almost nobody complains (I just found one post from 2000). Very unlikely that only I have this problem.

When IRAF is started in xterm/xgterm window, it does not get the size of the terminal window properly, although, as mentioned by Mikes's reply to that 2000 post, it should (see http://iraf.net/phpBB2/viewtopic.php?t=76544&sid=6fdf5737a4565504bafb645c55b43099).

Whatever the true size is, 'stty xterm' sets ttynlines to 65, 'stty xgterm' to 40, probably according to some hardcoded defaults. 'stty resize' does not work.

Needless to mention, 'stty size' in the system shell (outside IRAF) shows the right size, there are also COLUMNS/LINES env variables set properly. All other terminal-based software (editors etc.) recognize the size w/o any problem.

For all those years, I have been using a workaround, putting
set ttynlines=envget("LINES")
into login.cl file, somewhere after the "stty xterm" command.

Maybe it could be just fixed - cannot be a difficult job.

regards, Michal.
Back to top
View user's profile Send private message
fitz
Site Admin


Joined: 30 Sep 2005
Posts: 3255
Location: Tucson

PostPosted: Sun Mar 25, 2012 5:29 am    Post subject: Reply with quote

Specifically what platform is giving you this problem? I just tried "stty resize" on OSX and Linux, xterm and xgterm, and got the correct size before and after resizing the window in both cases.

Terminal sizes of 65 and 40 rows are the default only of you use 'xterm' or 'xterm40' as the reply to the terminal type prompt for a MKIRAF. Is there an 'stty' or a 'tset' command in your .cshrc file that could be resetting things? Do you start xterm/xgterm with any special command-line flags?
Back to top
View user's profile Send private message
msz1959



Joined: 22 Sep 2009
Posts: 5

PostPosted: Sun Mar 25, 2012 9:40 pm    Post subject: Reply with quote

At home, I use latest IRAF 2.16 on Ubuntu 11.04. At work, 2.15 on RHEL 5.x and MacOSX. There is no tset/stty in my .cshrc

If I do not give "xterm" at mkiraf prompt, just a lone "stty" w/o parameters is added to login.cl and it defaults to xgterm, 40 lines, which os both wrong for a xterm window of 24 lines. If I give "xterm", "stty xterm" appears in login.cl and it defaults to 65 lines.

Excerpt from my session:

> xterm & (from a gnome-teminal, just to be pure-xterm)
in the freshly open xterm:
> stty size
24 80
> cl
vocl> stty
xgterm ncols=80 nlines=40
vocl> stty resize
timeout - terminal type set wrong? (`stty termtype' to reset)
vocl> stty xterm resize
vocl> stty
xterm ncols=80 nlines=65
vocl>

If I give "xterm" to mkiraf, it is almost the same, just without resetting xgterm to xterm.

I have just found that it is a bit better in xgterm. "stty resize" seems to work. if so, it should probably be automatically added to login.cl by mkiraf script. If not, nlines defaults to 40.
Back to top
View user's profile Send private message
fitz
Site Admin


Joined: 30 Sep 2005
Posts: 3255
Location: Tucson

PostPosted: Tue Mar 27, 2012 12:01 am    Post subject: Reply with quote

It sounds like you're using an XTerm window, but keeping the 'xgterm' terminal setting. In this case, an 'stty resize' in fact doesn't get the correct size, but when using a real XGterm window will work as expected. Can you verify that when using the xterm/xgterm window and the appropriate termtype setting the resize works?
Back to top
View user's profile Send private message
msz1959



Joined: 22 Sep 2009
Posts: 5

PostPosted: Tue Mar 27, 2012 9:28 pm    Post subject: Reply with quote

Sorry if I did not put it clear enough.

If I run IRAF in an XTerm window, set-up as xterm (i.e. with "stty xterm" line in 'login.cl'), the no. of lines gets set to 65 and 'stty resize' does NOT work.

In a XGterm window, with IRAF set-up as xgterm ("stty xgterm" in 'login.cl'), the no. of lines is set properly and then, if I change the window size manually without leaving the IRAF, "stty resize" does set the window new size properly.
Back to top
View user's profile Send private message
fitz
Site Admin


Joined: 30 Sep 2005
Posts: 3255
Location: Tucson

PostPosted: Thu Mar 29, 2012 6:40 pm    Post subject: Reply with quote

This appears to be non-trivial to fix. The escape sequence to report the window size no longer appears to be recognized by XTerm and so when you type 'stty resize' the sequence is sent but no response is ever received, and so the hardwired value in the termcap is used.

I can't say specifically when this started but I know XTerm underwent a major rewrite a while ago. It appears that even though the man page says the sequence should work, it seems to reply on applications processing a SIGWINCH signal to respond to the resize. Your envget() workaround is fine when you first login, but needs to be done again if the window is resized. That and the SIGWINCH handling means nontrivial.

Just curious, is there some reason you use XTerm over XGterm anyway?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    iraf.net Forum Index -> Systems All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2009 phpBB Group
 Copyright © 2005-2011 iraf.net
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.09 seconds