#! /bin/sh
#
#   kon2alt.sh -- start kon2 on another VTY session
#	0.0: Aug  7, 2015 (v1.5)
#

PATH=/usr.bin:/usr/bin:/bin:/usr.sbin:/usr/sbin:/sbin:/usr/local/bin:/wipeout:.
export PATH

export TERM=vt100
export TTY=`/usr.bin/tty`

export TTY="${TTY:-ttyv0}"
export LOGFIL="${LOGFIL:-/tmp/wpoutlog.txt}"

n=`echo "$TTY" | sed 's/^.*\([0-9]\)/\1/'`
n=$(( $n + 1 ))
m=$(( $n + 1 ))
ntty=`echo $TTY | sed 's/[0-9]$/'"$n"'/'`

echo ''
echo "Starting new console session on VTY$n (Alt+F$m)"
/wipeout/shell-on $ntty
echo 'You can start another wipe-out session with "sh kon2alt.sh"' > $ntty
echo -n "Starting console session on VTY$n" >> $LOGFIL
date >> $LOGFIL

sleep 2

export KON2MODE=FIXed
/usr/local/bin/kon2fixed FIX -s -e /wipeout/alt-menu.sh < $TTY

# EOF
