#!/bin/sh
# the next line restarts using scotty -*- tcl -*- \
exec scotty2.1.11 "$0" "$@"

package require Tnm 2.1

##
## Simply probe all RPC services on a given host
##

proc probe {host} {
    if {[catch {
	foreach s [sunrpc info $host] {
	    if {[catch {eval "sunrpc probe $host $s"} p]} {
		puts stdout "$host: $s\t(probe failed)"
	    } else {
		puts stdout "$host: $s\t[join $p]"
	    }
	}
    } err]} {
	puts stderr $err
    }
}

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

foreach name $argv {
    probe $name
}

exit
