# HG changeset patch # User Christophe Lincoln # Date 1334617394 -7200 # Node ID a9f3ad0aff28c419c95fa73bf6853ca54175fa92 # Parent fdcc019189d9105ffbafe31141068a2f4dd3e518 libtaz.sh: use /dev/stdin and improve testsuite.sh diff -r fdcc019189d9 -r a9f3ad0aff28 rootfs/lib/libtaz.sh --- a/rootfs/lib/libtaz.sh Mon Apr 16 22:45:47 2012 +0200 +++ b/rootfs/lib/libtaz.sh Tue Apr 17 01:03:14 2012 +0200 @@ -67,8 +67,8 @@ html) done=" $okmsg" error=" $ermsg" ;; - *) - local cols=$(stty -a -F /dev/pts/1 | head -n 1 | cut -d ";" -f 3 | awk '{print $2}') + *) + cols=$(stty -a -F /dev/stdin | head -n 1 | cut -d ";" -f 3 | awk '{print $2}') local scol=$(($cols - 10)) done="\\033[${scol}G[ \\033[1;${okcolor}m${okmsg}\\033[0;39m ]" error="\\033[${scol}G[ \\033[1;${ercolor}m${ermsg}\\033[0;39m ]" ;; @@ -87,7 +87,7 @@ case $output in raw|gtk) local sepchar="-" && local cols="8" ;; html) local sepchar="
" ;; - *) local cols=$(eval stty -a -F /dev/pts/1 | head -n 1 | cut -d ";" -f 3 | awk '{print $2}') ;; + *) local cols=$(stty -a -F /dev/stdin | head -n 1 | cut -d ";" -f 3 | awk '{print $2}') ;; esac for c in $(seq 1 $cols); do echo -n "$sepchar" diff -r fdcc019189d9 -r a9f3ad0aff28 testsuite.sh --- a/testsuite.sh Mon Apr 16 22:45:47 2012 +0200 +++ b/testsuite.sh Tue Apr 17 01:03:14 2012 +0200 @@ -2,18 +2,24 @@ # . rootfs/lib/libtaz.sh -echo -n "Checking libtaz.sh: status() 0" -status +check_libtaz() { + echo -n "Checking libtaz.sh: status() 0" + status + + echo -n "Checking libtaz.sh: status() 1" + touch /tmp/1/2/2/4 2>/dev/null + status + + echo -n "Checking libtaz.sh: boldify() " + boldify "Message" + + echo "Checking libtaz.sh: separator" + separator +} -echo -n "Checking libtaz.sh: status() 1" -touch /tmp/1/2/2/4 2>/dev/null -status - -echo -n "Checking libtaz.sh: boldify() " -boldify "Message" - -echo "Checking libtaz.sh: separator" -separator +check_libtaz +output="raw" +check_libtaz echo "" exit 0