
transdir=trans/

# Actually do the argument parsing here

body=`echo $2`
dlg=`echo $body | sed 's/^.\(...\)./a\1/'`


alsig1=`echo ${body}t?1.al`
alsig2=`echo ${body}t?2.al`
ssig=`echo $body?1.al`
telemar=`echo $transdir${body}t.mar`

if [ -e $alsig1 ] 
  then
  echo found $alsig1. good.
else
  echo missing $alsig1.
  exit
fi

if [ -e $alsig2 ] 
  then
  echo found $alsig2. good.
else
  echo missing $alsig2.
  exit
fi

if [ -e $telemar ] 
  then
  echo found $telemar. good.
else
  echo missing telemar.
  exit
fi

echo $1

padbytes=`expr $1 \* 8`

echo $1

echo padbytes $padbytes

if [ $padbytes -gt 0 ]
  then
    echo padding $padbytes in $alsig2
    mv $alsig2 $alsig2.si
    /homes/kip/projekte/synctel/1000hz $padbytes > $alsig2
    cat $alsig2.si >> $alsig2
    sik=$alsig2.si
elif [ $padbytes -lt 0 ]
  then
    echo padding $padbytes bytes in $alsig1
    mv $alsig1 $alsig1.si
    /homes/kip/projekte/synctel/1000hz `expr -1 \* $padbytes` > $alsig1
    cat $alsig1.si >> $alsig1
    sik=$alsig1.si
    ~vmadmin/scripts/teloffs `expr -1 \* $1` $telemar


fi


echo REMOVE $sik AFTER CHECK...
