summaryrefslogtreecommitdiffstats
path: root/cholerab/max_dirty_hack.sh
diff options
context:
space:
mode:
authorLassulus <Lassulus@googlemail.com>2011-07-21 01:48:14 +0200
committerLassulus <Lassulus@googlemail.com>2011-07-21 01:48:14 +0200
commitf84414c0c522d787b888e6184277d9cb06fbb5cf (patch)
tree4f592c211ed7fceeb037f84313ad85f53e222e7c /cholerab/max_dirty_hack.sh
parent6a0eae9c9083de832c18b0abd9411446fbfe17d1 (diff)
1st try of cholerab
Diffstat (limited to 'cholerab/max_dirty_hack.sh')
-rwxr-xr-xcholerab/max_dirty_hack.sh98
1 files changed, 98 insertions, 0 deletions
diff --git a/cholerab/max_dirty_hack.sh b/cholerab/max_dirty_hack.sh
new file mode 100755
index 00000000..e8928d38
--- /dev/null
+++ b/cholerab/max_dirty_hack.sh
@@ -0,0 +1,98 @@
+#!/bin/sh
+stty -echo cbreak -ofdel
+x_max=90
+y_max=10
+x_cur=1
+y_cur=1
+y=
+t=1
+echo -n "c"
+
+while [ $t -lt $(( y_max+2 )) ];do
+ echo -e "[$t;$(( x_max+1 ))Hx"
+ t=$(( t+1 ))
+done
+t=1
+while [ $t -lt $(( x_max+2 )) ];do
+ echo -e "[$(( y_max+1 ));${t}Hx"
+ t=$(( t+1 ))
+done
+
+echo -n "[$y_cur;${x_cur}H"
+#Main Loop
+while x="`dd bs=1 count=1 2>/dev/null`"; do
+ y="$y$x"
+ case "$y" in
+ (*"")
+ if [[ $y_cur -le 1 ]];then
+ y_cur=$y_max
+ echo -n "[$y_cur;${x_cur}H"
+ else
+ echo -n ""
+ y_cur=$(( y_cur-1 ))
+ fi
+ y=
+ ;;
+ (*"")
+ if [[ $y_cur -ge $y_max ]];then
+ y_cur=1
+ echo -n "[$y_cur;${x_cur}H"
+ else
+ echo -n ""
+ y_cur=$(( y_cur+1 ))
+ fi
+ y=
+ ;;
+ (*"")
+ if [[ $x_cur -ge $x_max ]];then
+ x_cur=1
+ echo -n "[$y_cur;${x_cur}H"
+ else
+ echo -n ""
+ x_cur=$(( x_cur+1 ))
+ fi
+ y=
+ ;;
+ (*"")
+ if [[ $x_cur -le 1 ]];then
+ x_cur=$x_max
+ echo -n "[$y_cur;${x_cur}H"
+ else
+ echo -n ""
+ x_cur=$(( x_cur-1 ))
+ fi
+ y=
+ ;;
+ (*"")
+ if [[ $x_cur -le 1 ]];then
+ x_cur=$x_max
+ echo -n "[$y_cur;${x_cur}H"
+ else
+ echo -n " "
+ x_cur=$(( x_cur-1 ))
+ fi
+ y=
+ ;;
+ (|\[)
+ :
+ ;;
+ (*)
+ if [[ $x_cur -gt $x_max ]];then
+ x_cur=1
+ echo -n "[$y_cur;${x_cur}H"
+ elif [[ $x_cur -eq $x_max ]];then
+ echo -n "$x"
+ x_cur=1
+ echo -n "[$y_cur;${x_cur}H"
+ else
+ echo -n "$x"
+ x_cur=$(( x_cur+1 ))
+ fi
+ y=
+ ;;
+ esac
+ state=`echo -n "$x" | od -An -tx | tr -d "[$IFS]"`
+ echo -n "7[1;$(( x_max+2 ))H$state8"
+ echo -n "7[2;$(( x_max+2 ))H 8"
+ echo -n "7[2;$(( x_max+2 ))H$x_cur:$y_cur8"
+done