#!/bin/sh

: invoked from mhn as st_play.sh %a [-generic] '%F'
: e.g., with an mhn profile entry of
:	    mhn-show-application/safe-tcl: %pst_play.sh %a -generic '%F'

F= S=
for A in $*; do
    case "$A" in
	version=*)
	    if [ "$A" != "version=7.3" ]; then
		echo -n "wrong " 1>&2
		echo "$A" | sed -e 's%=% %' 1>&2
		exit 1
	    fi
	    ;;

	evaluation-time=*)
	    if [ "$A" != "evaluation-time=activation" ]; then
		echo -n "wrong " 1>&2
		echo "$A" | sed -e 's%=% %' 1>&2
		exit 1
	    fi
	    ;;

	*=*)
	    ;;

	-generic)
	    S="$S -generic"
	    ;;

	*)  F="$A"
	    ;;
    esac
done

MM_NOASK=1 export MM_NOASK
swish -safe $S -messaging -file "$F"
