This is what I do on 5.0/i386.

I have this line in /etc/ttys:
ttyC5   "/bin/Lock"     vt220   on  secure

To lock the computer I run this executable /bin/Lock:
#!/bin/sh
pass=sparken
exe=/bin/Lock
fifo=/var/Lock
case "$1" in
ttyC*)  t=/dev/$1
        tty=$t exec $exe exe < $t > $t 2> $t ;;
exe)    ;;
*)      echo > $fifo
        exit ;;
esac
mknod -m 0666 $fifo p
for i in eof intr kill quit susp start stop \
         dsusp lnext reprint status; do
        stty $i undef
done
stty -echo
while :; do
        jot 200
        echo -n computing
        cat < $fifo > /dev/null
        focus=$(wsconsctl display.focus)
        t=${tty#/dev/ttyC}
        wsconsctl display.focus=$t > /dev/null
        map=$(wsconsctl keyboard.map | grep Cmd_)
        map2=$(echo "$map" | sed 's/=.*/= x/')
        wsconsctl keyboard.map+="$map2"
        while :; do
                read -r r
                [ _"$r" = _"$pass" ] && break
                echo -n .
        done
        wsconsctl keyboard.map+="$map"
        wsconsctl $focus > /dev/null
done

Reply via email to