#!/bin/sh
# the next line restarts using tclsh -*- tcl -*- \
exec tclsh "$0" "$@"
#
# rpcprobe --
#
#	This example shows how one can probe all ONC rpc services
#	registered on a target host by using the TnmInet library.
#	For details how probing works, please read the implementation
#	of the TnmInet package.
#
# Copyright (c) 1995-1996 Technical University of Braunschweig.
# Copyright (c) 1996-1997 University of Twente.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# @(#) $Id: rpcprobe,v 1.4 1997/12/29 09:10:39 schoenw Exp $

package require Tnm 3.0
package require TnmInet $tnm(version)

# Check the commandline and start probing.

if {$argc<1} {
    puts stderr "usage: rpcprobe hosts"
    exit
}

foreach host $argv {
    if [catch {
	set ip [TnmInet::GetIpAddress $host]
	set name [TnmInet::GetIpName $host]
    } msg] {
	puts stderr "rpcprobe: $msg"
	continue
    }
    puts "\n$name \[$ip\]:"
    puts [TnmInet::RpcServices $host]
}
