#! /bin/sh

cmd=""
args=""
QUIET=0

while [ $# -gt 0 ]
do
        case $1 in
	+p|+ppn|++ppn)
		args=$args" "$1" "$2
		shift;
		shift
		;;
	++quiet)
		QUIET=1
		shift
		;;
	++no-quiet)
		QUIET=0
		shift
		;;
	++local|++no-local)
		# consume and ignore, local-mode is all that multicore supports
		shift
		;;
	+*)
		args=$args" "$1
		shift
		;;
	*)
		if [ -z "$cmd" ]; then
			cmd=$1
		else
			args=$args" "$1
		fi
		shift
		;;
	esac
done

test $QUIET -eq 1 && args=$args" "++quiet

test $QUIET -eq 0 && echo Running command: $cmd $args
test $QUIET -eq 0 && echo

exec $cmd $args
