#menu# set the node name of this machine
#help#	This allows you to change the "node name" of this machine.  The
#help#	"node name" used by various communications networks to identify
#help#	this machine.

flags="-qq -k$$"	# flags for checkyn to implement [q] (quit)

trap 'exit 0' 1 2 15

uname=`/usr/net/hostname`

checkyn ${flags} -f  -H '
	The "node name" is used by various communications networks to identify
	this machine.' \
	"This machine is currently called \"${uname}\".
Do you want to change it?"  ||  exit 0

name=`checkre ${flags} -fe "What name do you want to give it? [q]" \
	'.' 'There must be a name.' \
	'^[0-9a-zA-Z]\{1,\}$' 'Only letters and numbers are permitted.' \
	'^.\{1,64\}$' 'No more than 64 letters and numbers are permitted.'`

/usr/net/hostname ${name}
if [ -f /etc/local_hostname ]
then
	echo "${name}" > /tmp/hn.$$
	tail +2 /etc/local_hostname >> /tmp/hn.$$
	mv /tmp/hn.$$ /etc/local_hostname
else
	echo "${name}" > /etc/local_hostname
fi
