#!/bin/csh

set infile=$1
set port=$2
set prog=$3
set node=0
set totNodes=0
shift 
shift
shift

set machinelist = `cat $infile`

foreach machine ( $machinelist )
   if ( $machine != "" ) then
      if ( $totNodes == 0 ) then
        set manager=$machine
      endif
      @ totNodes++
   endif
end
foreach machine ( $machinelist )
   if ( $machine != "" ) then
      rsh -n $machine $prog $manager $port $node $totNodes $* &
      @ node++
   endif
end
