Ref: 13930008
Title: Script to Search Clearinghouse Name for an Ethernet Address
Date:  10/16/90

Copyright 3Com Corporation, 1991.  All rights reserved.

A shell script is like a macro, in that it can be set up to perform a
specific function on the network, and users can execute the file with a
one-line command.  A shell script is a named file that contains C-shell
language; it can only be executed in 3Com's Network Control Server/1
(NCS/1).

In a large network environment with several clearinghouse names, the
following shell script will help a network manager to search for the
clearinghouse name associated with a given Ethernet address.

-----------------------------------------------------------------------
#! /bin/csh -f
#
#  NAME
#
#      search_chn
#
#      search_chn <Ethernet address> or <network number>
#

set noglob

if ( $#argv !=1 ) goto usage

if ( $argv[1] == "?" ) then
  usage:
    echo  "Usage:  search_chn '<Ethernet address>' '<network number>'"
    exit -1
endif

set list = 'show chn '*@*@*' | sed -e 1d'

if ( $#list == 0 ) then
    echo "empty clearinghouse !!"
    exit 0
endif

foreach i ( $list )
    echo -n
    show chn $i | fmt | grep $1 >> tmp
end

if ( -z tmp ) then
    echo "No clearinghouse name(s) defined for $1"
else
    more tmp
endif

rm tmp
-----------------------------------------------------------------------

1.  Create the shell script under the /usr/ncs/local directory.

2.  After creating the shell script, make it executable by typing:

chmod +x search_chn

3.  Execute the shell script by typing:

search_chn <Ethernet address> <network number>

    For example, search_chn 08000200ABCD
