#!/bin/bash

rm -f q

. ../init.sh

applets=$(q -Ch | \
	sed -n '/^Currently defined applets:/,/^Options/p' | \
	grep ' : ' | \
	awk '{print $1}'
)
rm -f ${applets}

if ! ln -f `which q` ; then
	skip "could not 'ln -f'"
fi
./q -i || die "./q -i"

for app in ${applets} ; do
	[ ! -e $app ] && die "$app does not exist"
	if [ "$app" != "q" ] ; then
		t=$(readlink $app)
		[ "$t" != "q" ] && die "$app target is not 'q', it is '$t'"
	fi
done
rm ${applets}

pass
