#!/bin/sh -x
# Makeshort -- a script for making a file of C preprocessor declarations
# to reduce the size of variable names. The maximum size is set in the
# call to shortnames.awk below.
# This procedure is specific for the Cray Unicos implmentation of CONGEN.
# Usage:
#        nm *.o | makeshort >shortname.h

if [ -n "${TMPDIR}" -a -w "${TMPDIR}" -a -d "${TMPDIR}" ]
then
    tmpname1=$TMPDIR/short1$$
    tmpname2=$TMPDIR/short2$$
else
    tmpname1=/tmp/short1$$
    tmpname2=/tmp/short2$$
fi

cat >${tmpname1}
nawk -f ${CGBIN}/getnames.awk <${tmpname1} >${tmpname2}
nawk -f ${CGBIN}/getcommon.awk <${tmpname1} | tr "[a-z]" "[A-Z]" >>${tmpname2}
sort -u ${tmpname2} | nawk -f ${CGBIN}/shortnames.awk maxlength=8 
rm ${tmpname1} ${tmpname2}


