#!/bin/sh
#
#

trap "rm -f $DUMP $NAMES $DUMP.tmp $NAMES.tmp; exit" 0 2 3

DUMP="textdump"
NAMES="names"

if [ X$1 != X ]; then
	DUMP=$1
fi

echo Dumping in $DUMP

# assume this is the output from dumpsplit, so cut names
cut -d' ' -f2 ${NAMES} > ${NAMES}.tmp

x=0
for f in `cat ${NAMES}.tmp`; do
  x=`expr $x + 1`
  echo \$$f
  echo name $f $x >> index.coldc
  cat ${f}.coldc >> ${DUMP}.tmp
done

sed 's:^name sys [0-9][0-9]*$:name sys 0:g' index.coldc > ${DUMP}
cat ${DUMP}.tmp >> ${DUMP}

exit