SVN: rc-scripts/trunk/rc.d/init.d/functions

glen glen at pld-linux.org
Thu Feb 12 12:29:35 CET 2009


Author: glen
Date: Thu Feb 12 12:29:34 2009
New Revision: 10122

Modified:
   rc-scripts/trunk/rc.d/init.d/functions
Log:
- calculate default INIT_COL from terminal size

Modified: rc-scripts/trunk/rc.d/init.d/functions
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/functions	(original)
+++ rc-scripts/trunk/rc.d/init.d/functions	Thu Feb 12 12:29:34 2009
@@ -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 @@
 [ -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 @@
 
 	# 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


More information about the pld-cvs-commit mailing list