#!/bin/sh
# A dmodemd for the smoke test: it takes --tcp HOST:PORT, says which
# port to use as dmodemd does, and starts the test modem on that port.
here=$(cd "$(dirname "$0")" && pwd)
port=$(echo "$*" | sed -n 's/.*--tcp [0-9.]*:\([0-9]*\).*/\1/p')
echo "test dmodemd: $*"
(sleep 1; echo "Use TCP 127.0.0.1:$port as the modem") &
exec python3 -u "$here/fake_modem.py" "$port" "$DMODEM_TEST_LOG"
