#!/bin/csh -f 
#
# This script zlocates a person and fingers all the machines on which
# that person is logged in.
#

if ($#argv == 0) then
   echo "Usage: zfinger usename [username ...]"
   exit 1
endif

set users = ($argv)
foreach user ($users)
   if ($#users > 1) echo ${user}:
   zlocate $user >& /tmp/zfinger.$$
   set zstatus = $status
   if ($zstatus) then
      cat /tmp/zfinger.$$
      continue
   endif

   set hosts = (`awk '{print $1}' /tmp/zfinger.$$`)
   foreach host ($hosts)
      timeout 15 finger @$host
   end
end

exit 0
