DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦65b09aa60⟧ TextFile

    Length: 2383 (0x94f)
    Types: TextFile
    Notes: UNIX file
    Names: »delhost«

Derivation

└─⟦8c4f54e61⟧ Bits:30004068/disk2.imd Interactive TCP/IP v.1.2
└─⟦8c4f54e61⟧ UNIX Filesystem
    └─⟦this⟧ »hb/new/usr/admin/menu/packagemgmt/tcpipmgmt/delhost« 

TextFile

#ident	"@(#)delhost	3.1 - 88/06/01"

#ident	"@(#)delhost	1.2 - 87/07/28"
#	This shell is used to delete host names from /etc/hosts
#	and from /etc/hosts.smtp

PACKAGE="Extended Networking Utilities"
PATH=:/bin:/usr/bin:/usr/lbin
HOST=/etc/hosts
EQUIV=/etc/hosts.equiv
SMTP=/etc/hosts.smtp
XDIR=$MENUTOP/menu/packagemgmt/tcpipmgmt
cd $XDIR

FIRST=true
flags="-qq -k$$"
trap 'exit 0' 1 2  15

if [ -f "$HOST" -a \( ! -w "$HOST" -o ! -r "$HOST" \) ]; then
	admerr $0 "Can't write and read '$HOST'\nCan't do delete operation!\n"
	exit
fi
if [ -f "$SMTP" -a \( ! -w "$SMTP" -o ! -r "$SMTP" \) ]; then
	admerr $0 "Can't write and read '$SMTP'\nCan't do delete operation!\n"
	exit
fi

if [ ! -r $HOST ]; then
	echo "There are no entries in the '$HOST' file
Use hostmgmt to add entries.\n"
	exit
fi

echo "
This procedure is used to delete entries in the
$PACKAGE '$HOST' file.
This file contains information on how this machine, '`uname`',
contacts remote systems.
"

while $FIRST || chkyn -f ${flags} '
Any other deletions?'  || exit
do
FIRST=false

syslist=`grep '^[^#]' $HOST  2>/dev/null | \
	sed 's/[^ 	]*[ 	]*\([^ 	]*\).*/\1/' \
	|  sort -u  |	grep '^[A-Za-z0-9]'`

if [ $? -ne 0 ]; then
	echo "There are no entries in the '$HOST' file
None can be deleted!\n"
	exit
fi

echo "\nThis is the current list of hosts known to the $PACKAGE:\n"
echo "${syslist}"  |  pr -t -w80 -4

hostname=`chkyn ${flags} -fer '
Which host name do you want to delete? [q]' \
	'.' 'You must enter at least one character.' \
	'^[a-zA-Z0-9]' 'First character must be a letter or number.'`

idline=`grep "${hostname}" $HOST`
if [ $? -eq 0 ]
then
	echo "\nHere is the hosts file entry for machine '${hostname}'."
	cat <<-! |while read a b c; do /bin/sh _hostprint $a $b $c; done
		${idline}
	!

	if  chkyn ${flags} -h'?' -H"
	If you answer  y  '${hostname}' will no longer be known to the $PACKAGE." \
		-f "Do you want to delete the host named '${hostname}'?"
	then
		ed - $HOST <<-! > /dev/null 2>&1
			H
			g/${hostname}/d
			w
			q
		!

		ed - $SMTP <<-! > /dev/null 2>&1
			H
			g/${hostname}/d
			w
			q
		!

		ed - $EQUIV <<-! > /dev/null 2>&1
			H
			g/${hostname}/d
			w
			q
		!

		if [ $? != 0 ]
		then
			admerr $0 Could not edit $HOST
			exit 1
		fi

		echo "\n **** host '${hostname}' has been deleted from '$HOST' ****\n"
	fi

else
echo "\n\\t'${hostname}' does not exist in '$HOST'.\n"
fi

done