#!/bin/sh
VERSION=`grep VERSION prog_version.h | awk -F\" '{print $2}'`
PATCH=`grep PATCHLEVEL prog_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 << _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 documentation at the end of this file for how to build
# your own macros.

_EOF_

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

cat DISTRESS.DOC >> tmp$$
sed 's/^/# /g' NEWMACRO.DOC >> tmp$$
mv tmp$$ $NAME
