mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
4789bac85e
message for them. This is to mimic a common way games are played on Android and to ensure that there are no points where that style of play hangs because no device in the game will be "up".
52 lines
1.2 KiB
Bash
Executable file
52 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -u -e
|
|
|
|
usage() {
|
|
echo "usage: %0 --long|--short logfile*"
|
|
exit 1
|
|
}
|
|
|
|
if [ "--long" = $1 ]; then
|
|
LONG=1
|
|
elif [ "--short" = $1 ]; then
|
|
LONG=""
|
|
else
|
|
usage
|
|
fi
|
|
|
|
shift
|
|
|
|
while [ $# -ge 1 ]; do
|
|
LOG=$1
|
|
while read LINE; do
|
|
case "$LINE" in
|
|
*got_connect_cmd:\ connName* )
|
|
CONNNAME="$(echo $LINE | sed 's,^.*connName: "\(.*\)"$,\1,')"
|
|
;;
|
|
*hostid* )
|
|
HOSTID=$(echo $LINE | sed 's,^.*set hostid: \(.\)$,\1,')
|
|
;;
|
|
*getChannelSeed:\ channelSeed:*)
|
|
SEED=$(echo $LINE | sed 's,^.*getChannelSeed: channelSeed: \(.*\)$,\1,')
|
|
;;
|
|
esac
|
|
done < $LOG
|
|
if [ -z "${CONNNAME}" ]; then
|
|
echo "CONNNAME not found in $LOG" >&2
|
|
elif [ -z "${HOSTID}" ]; then
|
|
echo "HOSTID not found in $LOG" >&2
|
|
elif [ "${HOSTID}" -eq 0 ]; then
|
|
echo "HOSTID 0 in $LOG; try later" >&2
|
|
elif [ -n "$LONG" -a -z "${SEED}" ]; then
|
|
echo "SEED not found in $LOG" >&2
|
|
else
|
|
RESULT=${CONNNAME}/${HOSTID}
|
|
if [ -n "$LONG" ]; then
|
|
RESULT="${RESULT}/${SEED}"
|
|
fi
|
|
echo $RESULT
|
|
fi
|
|
|
|
shift
|
|
done
|