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

baggins baggins at pld-linux.org
Thu Apr 26 23:38:06 CEST 2007


Author: baggins
Date: Thu Apr 26 23:38:04 2007
New Revision: 8478

Modified:
   rc-scripts/trunk/rc.d/init.d/functions
Log:
- shell magic fixing screwed dots in show() on serial console


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 Apr 26 23:38:04 2007
@@ -100,7 +100,6 @@
 	esac
 }
 
-INIT_DOTS=$(awk -vcol=$INIT_COL 'BEGIN{ for(i = 0; i < col; i++) printf("."); }')
 if is_yes "$FASTRC"; then
 	RC_LOGGING=no
 fi
@@ -292,26 +291,26 @@
 # Some functions to handle PLD Linux-style messages
 show()
 {
-	typeset out
+	typeset text
+	typeset -i len
 
-	out=$(
-		echo -n "$INIT_DOTS"
-		termput hpa 0
-		if [ -n "$CHARS" ]; then
-			termput setaf $CCHARS
-			echo -n "$CHARS"
-			termput op
-		fi
-
-		if is_no "$FASTRC" && is_yes "$GETTEXT"; then
-			nls -n "$@"
-		else
-			printf "$@"
-		fi
+	if is_no "$FASTRC" && is_yes "$GETTEXT"; then
+		text=$(nls -n "$@")
+	else
+		text=$(printf "$@")
+	fi
+	len=${#text}
+	while [ $((len++)) -lt $INIT_COL ]; do
+		text="$text."
+	done
+	if [ -n "$CHARS" ]; then
+		termput setaf $CCHARS
+		echo -n "$CHARS"
+		termput op
+	fi
+	echo -n "$text"
 
-		termput hpa $INIT_COL
-	)
-	echo -n "$out"
+	termput hpa $INIT_COL
 }
 
 deltext()


More information about the pld-cvs-commit mailing list