#sccs	"@(#)fndetc/convert:namesysconv	1.4"

#
#	FILE:  namesysconv
#
#	This program truncates the Email name in /etc/namesys to
#	eight (8) letters.  The contents of the file are assumed
#	to be: "setuname -n NAME", or "COMMAND SWITCH NAME".
#

if [ $# -lt 2 ]
then
	echo "usage:  convbydiff {old file} {new file}"
	exit
fi

if [ $# -eq 3 ]
then	VERBOSE=$3
else	VERBOSE=""
fi

OLDFILE=$1
NEWFILE=$2

#	In the new release, the system Email name must be truncated
#	to eight (8) letters.  That is all that uucp recognizes.

BUF=`cat $OLDFILE`
NAME=`echo $BUF | cut -d' ' -f3 | cut -c1-8`
CMD=`echo $BUF | cut -d' ' -f1-2`

LNAME=`expr "$NAME" : '.*'`
MNAME=`expr "$NAME" : '[a-z,A-Z,0-9,_]\{1,8\}'`

if [ "$MNAME" != "$LNAME" ]
then	NAME="UNIXPC"
fi

echo "$CMD $NAME" > /tmp/namesys
mv /tmp/namesys $NEWFILE
chmod +x $NEWFILE

#	Do listing update as necessary.

if [ "$VERBOSE" ]
then 
	echo "new Release file updated with:"
	cat $NEWFILE
	echo
fi

