PDA

View Full Version : [SOLVED] How to probe terminal dimensions from Perl



paxxus
March 24th, 2011, 11:20 PM
As the title says. I want to probe the number of lines and number of columns in the terminal (xterm). Is this possible?

johnl
March 25th, 2011, 03:42 AM
You can find the height and width in the environmental variables LINES and COLUMNS.

An alternative is to perform a TIOCGWINSZ ioctl().

paxxus
March 25th, 2011, 10:49 AM
Thanks john - TIOCGWINSZ also gives a lot more relevant hits in Google than what I searched for before.