From 66f7cface6f0a029368c393cdbe8fd34047b0624 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 12 Feb 2009 11:29:34 +0000 Subject: [PATCH] - calculate default INIT_COL from terminal size svn-id: @10122 --- rc.d/init.d/functions | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 436cd030..dbdc7142 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -16,7 +16,18 @@ export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin" # Set defaults -INIT_COL=67 +if [ -z "$COLUMNS" -o -z "$LINES" ]; then + _setterm() { + set -- $(stty size 2>/dev/null) + LINES=${LINES:-$1} + COLUMNS=${COLUMNS:-$2} + } + _setterm + unset _setterm +fi +[ -z "$COLUMNS" ] && COLUMNS=80 +export LINES COLUMNS +INIT_COL=$((COLUMNS - 13)) # Set colors RED=1 @@ -46,7 +57,6 @@ CCHARS="$NORMAL" # Color of these characters (look at /etc/sysconfig/init-colors [ -r /etc/sysconfig/init-colors ] && . /etc/sysconfig/init-colors [ -r /etc/sysconfig/system ] && . /etc/sysconfig/system [ -r /etc/sysconfig/bootsplash ] && . /etc/sysconfig/bootsplash -[ -z "$COLUMNS" ] && COLUMNS=80 if [ -z "$VSERVER" -o "$VSERVER" = "detect" ]; then { @@ -990,7 +1000,7 @@ rc_cache_init() { # We create $check variable which is used to invalidate the cache. # The $check contains user locale and terminal. - local check="$term.$LC_MESSAGES" + local check="$term.$LC_MESSAGES.$INIT_COL" if [ -f "$cachefile" -a "$cachefile" -nt /etc/sysconfig/system -a "$cachefile" -nt /etc/sysconfig/init-colors ]; then if . "$cachefile" 2>/dev/null; then -- 2.44.0