chiark / gitweb /
Fix some line enablements
[trains.git] / hostside / fun-randmore
1 #!/bin/sh
2 set -e
3 while true; do
4         echo
5         which=$(hexdump </dev/urandom -n1 -e '"%d"')
6         if [ $which -ge 64 -a $which -lt 192 ]; then
7                 b1=$(hexdump </dev/urandom -n1 -e '"%d"')
8                 squ=$(($b1 * $b1))
9                 speed=$(($squ / 516))
10                 b2=$(hexdump </dev/urandom -n1 -e '"%d"')
11                 dirn=$(($b2 / 128))
12                 echo which=$which b1=$b1 speed=$speed b2=$b2 dirn=$dirn
13                 ./hostside-old -s/dev/ttya0 speed126 2 $speed $dirn
14         fi
15         if [ $which -lt 128 ]; then
16                 value=$(( $which * 16 ))
17                 printf "which=%s value=%s value=0x%x\n" $which $value $value
18                 ./hostside-old -s/dev/ttya0 funcs5to8 2 $value
19         fi
20         delay=$(hexdump </dev/urandom -n1 -e '"%d"')
21         delayv=$(( $delay / 2 + 10 ))
22         printf "delay=%d delayv=%d\n" $delay $delayv
23         sleep $delayv
24 done