#!/bin/sh -f
RC=""
IFS=:
for i in "$PLAN9" `echo ":${HOME}/plan9:/usr/local/plan9:/usr/local/9:/opt/plan9:/opt/9:/usr/plan9:/usr/9"`; do
	if [ -d "$i" -a -x "$i/bin/rc" ]; then
		export PLAN9="$i"
		RC="$i/bin/rc"
		break;
	fi
done

if [ ! -n "$RC" ]; then
	exit 1
fi

if [ -n "$1" ]; then
	exec "$RC" "$@"
else
	true
fi
