#!/bin/sh
#
# shell script to build a vif config:
#   args are config name without suffix
#   and optionally the kbd and pty filter flags
#   -k and -t
#
cat /dev/null > kbxxx
cat /dev/null > ptxxx
while test $1
do case $1 in
	-k)
		kblflag=yes
		shift ;;
	-t)
		ptlflag=yes
		shift ;;
	*)
		conf=$1
		shift ;;
	esac
done
if test $kblflag
then	lex -t $conf.kbl|sed -f lexsed|sed -e "/xx/s//kbd/g">kbxxx
fi
if test $ptlflag
then	lex -t $conf.ptl|sed -f lexsed|sed -e "/xx/s//pt/g">ptxxx
fi
cat $conf.cnf kbxxx ptxxx>xxx.c
cc -c -I../../include -I../../icons xxx.c
# this ld step is not critical but makes the file smaller
# if your loader can't do it, just replace with
mv xxx.o $conf.vif
echo "Config is in file" $conf.vif
echo "It must be copied to CONFLIB"
rm -f xxx.o xxx.c kbxxx ptxxx
