#!/bin/sh
# define here how to start the different nodes. Note that
# node 0 is already running and should NOT be started 
# here. The number of nodes to run is passed into this 
# script as the first parameter. The second paramter
# is the program to start on each node (this may be an
# absolute pathname or a relative pathname), and the
# rest are the arguments for this program

# PWD=`pwd | sed "s/.*$LOGNAME/\/u\/$LOGNAME/"`
nodes=$1
shift
prog=`echo $1 | sed "s/.*$LOGNAME/\/u\/$LOGNAME/"`
shift
options="$prog $*"
start() {
   if expr $nodes \>= $2 > /dev/null
   then
#      /usr/local/bin/export -attr $1 -force xterm -fn 7x13 -T "$1: $prog" -exec sh -c "$options" & 
	/usr/local/bin/export -attr $1 -force sh -c "$options" & 
#       /usr/local/bin/export -attr $1 -force xterm -fn 7x13 -T "$1: $prog" -exec sh -c "gdb $prog" & 
   fi
}

case $nodes in
[123]) ;;
*) echo "Sorry, I can start only 1, 2 or 3 nodes (you wanted $nodes)"
   exit 1;;
esac

start samosa 2
start icsib18 3
exit 0
