#!/bin/bash
gforth-fast server-test.fs +file $* >server &
SERVER=$!
gforth-fast client-test.fs +file $* localhost >client
kill -2 $SERVER
grep 'file.read:' server | sed -e 's/ read//g' | grep -v ' \$0 *$' >server.read
grep 'encrypt:' server | sed -e 's/encrypt:/crypt:/g' | grep -v ' \$0 *$' >server.crypt
grep 'file.write:' client | sed -e 's/ write//g' | grep -v ' \$0 *$' >client.write
grep 'decrypt:' client | sed -e 's/decrypt: \([0-9A-F]*\) \([0-9A-F]*\) \([0-9A-F]*\)/crypt: \1 \3 \2/g' | grep -v ' \$0 *$' >client.crypt
diff -u server.read client.write
