[rsbac] [diff] rsbac_menu terminal size detection fix

torc torc at iptel.by
Tue Feb 22 16:21:52 CET 2005


Hello,

Attached is my quick fix for the terminal size detection issue, please
test if it works fine for you. Thanks and take care!

===

--- old/rsbac_menu      2005-02-22 15:58:54.000000000 +0200
+++ new/rsbac_menu      2005-02-22 15:58:54.000000000 +0200
@@ -67,14 +67,18 @@
   exit
 fi
 
-# test for LINES and COLUMNS (should be exported e.g. in /etc/profile)
-if test -z "$LINES" ; then LINES=25 ; fi
-if test -z "$COLUMNS" ; then COLUMNS=80 ; fi
-export LINES
-export COLUMNS
-declare -i BL=$LINES-4
-declare -i BC=$COLUMNS-4
-declare -i MAXLINES=$LINES-10
+set_geometry () {
+LINES=
+COLUMNS=
+BL=${1:-24}
+BC=${2:-80}
+[ $BL = 0 ] && BL=24
+[ $BC = 0 ] && BC=80
+BL=$((BL-4))
+BC=$((BC-5))
+MAXLINES=$BL-10
+}
+set_geometry `stty size 2>/dev/null`
 gl () {
   if test $1 -gt $MAXLINES
   then echo $MAXLINES

===

-- 
Best regards,
 torc                          mailto:torc at iptel.by
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rsbac_menu.diff.gz
Type: application/x-gzip
Size: 389 bytes
Desc: not available
Url : http://www.rsbac.org/pipermail/rsbac/attachments/20050222/11d85b58/rsbac_menu.diff.bin


More information about the rsbac mailing list