#!/bin/sh
D=$(pwd)
FENIX=$D/runtime.pc

#build
rm $D/fxfnav.dcb
cd $D/src/
$FENIX/fxc fxfnav.prg
mv fxfnav.dcb $D/fxfnav.dcb
cd $D

#run
if test -f fxfnav.dcb ; then 
    $D/service/commander.sh /dev/shm/fxfnav.cmd /dev/shm/fxfnav.res &
    $FENIX/fxi fxfnav.dcb
    killall commander.sh
    killall cat
    
    if test -f /dev/shm/fxfnav.cd; then
	EOE=$(cat /dev/shm/fxfnav.cd)
	echo "CD ON EXIT: $EOE";
#	cd "$EOE"
    fi

    if test -f /dev/shm/fxfnav.exec; then
	EOE=$(cat /dev/shm/fxfnav.exec)
	echo "EXEC ON EXIT: $EOE";
#	exec "$EOE"
    fi
fi
