xwords/xwords4/linux/scripts/newrelay.sh

48 lines
1,011 B
Bash
Raw Normal View History

2010-09-11 10:39:20 +02:00
#!/bin/sh
2010-09-12 12:53:39 +02:00
DICT=${DICT:-./dict.xwd}
2010-09-11 10:39:20 +02:00
COOKIE=${COOKIE:-foo}
NGAMES=${NGAMES:-1}
NPLAYERS=${NPLAYERS:-2}
USE_GTK=${USE_GTK:-FALSE}
HOST=${HOST:-localhost}
PORT=${PORT:-10997}
[ $USE_GTK = FALSE ] && CURSES_PARM="-u -0"
2010-09-11 10:39:20 +02:00
2010-09-18 16:35:16 +02:00
LOGDIR=$(basename $0)_logs
2010-09-25 05:19:12 +02:00
[ -d $LOGDIR ] && mv $LOGDIR /tmp/${LOGDIR}_$$
2010-09-18 16:35:16 +02:00
mkdir -p $LOGDIR
2010-09-11 10:39:20 +02:00
usage() {
echo "usage: [env=val *] $0" 1>&2
echo " current env variables and their values: " 1>&2
for VAR in COOKIE DICT NGAMES NPLAYERS HOST PORT USE_GTK; do
2010-09-11 10:39:20 +02:00
echo "$VAR:" $(eval "echo \$${VAR}") 1>&2
done
exit 0
}
while [ -n "$1" ]; do
case $1 in
*) usage
;;
esac
shift
done
for II in $(seq $NGAMES); do
REMOTES=""
for JJ in $(seq $((NPLAYERS-1))); do
REMOTES="${REMOTES} -N"
done
for JJ in $(seq $NPLAYERS); do
./obj_linux_memdbg/xwords $CURSES_PARM -d $DICT -r Eric $REMOTES \
-a $HOST -p $PORT -C $COOKIE -q 2 2>${LOGDIR}/log_${II}_${JJ}.txt >/dev/null &
2010-09-11 10:39:20 +02:00
done
done
wait
echo "$0 done"