From eec03d8c44d76e023cc836ee63be3110e3bd082a Mon Sep 17 00:00:00 2001 From: pdontthink Date: Tue, 18 Mar 2008 01:30:50 +0000 Subject: [PATCH] Get screen width dynamically if possible git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13042 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/conf.pl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/config/conf.pl b/config/conf.pl index ec34d48c..cefeca33 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -546,7 +546,20 @@ if ( $config_use_color == 1 ) { # lists can be printed in more than one column; default is just one # $columns = 1; -$screen_width = 80; + +# try to get screen width dynamically if possible; default to 80 +# (user can override with "w#" command) +# +eval { require "sys/ioctl.ph" }; +if ($@ + || !defined &TIOCGWINSZ + || !open(TTY, "+ number of columns\n"; - print "W# Change screen width to <#>\n"; + print "W# Change screen width to <#> (currently $screen_width)\n"; } elsif ( $menu == 9 ) { print $WHT. "Database\n" . $NRM; print "1. DSN for Address Book : $WHT$addrbook_dsn$NRM\n"; -- 2.25.1