#!/bin/sh
ucspi=`which tcpserver`
ucspi=`dirname $ucspi`
cd `dirname $0`
if [ -f run ]; then
  dline=`grep "^DPORT=" run`
  dport=`expr "$dline" : '.*=\(.*\)'`
fi
prefix=${PREFIX:-`cat ../PREFIX`}

cat $1.src | sed -e '/^##/d' -e "s|_UCSPI_TCP_|$ucspi|" \
		-e "s/_DPORT_/${dport:-9999}/" \
		-e "s|_ABM_|$prefix/bin|" > $1
chmod +x $1
