#!/bin/sh
VERSION=`grep VERSION version.h | awk -F\" '{print $2}'`
PATCH=`grep PATCHLEVEL version.h | awk '{print $3 }'`
if [ $PATCH -eq 0 ] ; then
        NAME=BRMH-${VERSION}-xtrekrc.default
else
        NAME=BRMH-${VERSION}p${PATCH}-xtrekrc.default
fi

if [ ! -r tmp-xtrekrc ] ; then
   echo tmp-xtrekrc not found.  This must be created by the client
   echo with the ShowDefaults switch.
   exit 1
fi

cat windows.doc >> tmp-xtrekrc

cat << _EOF_ >> tmp$$
# These are the default settings for BRMH-${VERSION}.  Don't use this file as an
# xtrekrc -- it will only slow down startup.  Instead, find the values you
# wish to change and put them in your ~/.xtrekrc file.
# Also see the macro and RCD documentation at the site where you got this
# client.

_EOF_

#sort tmp-xtrekrc | uniq | sed 's/^([a-zA-Z0-9._ -\#<>/\[\]]*) //g' >> tmp$$
sort tmp-xtrekrc | uniq | sed 's/^(.*) //g' >> tmp$$

mv tmp$$ $NAME
echo output is $NAME
