#!/bin/sh
newargs=""
output_flag=0
output_name=""

for arg in $@
do
	if [ "$output_flag" -eq "1" ]
	then
		output_flag=2
		output_name=$arg
	
	elif [ $arg == "-o" ] && [ "$output_flag" -eq "0" ]
	then
		output_flag=1
	
	elif `echo $arg | grep -E -e "^-o" > /dev/null` && [ "$output_flag" -eq "0" ]
	then
		output_name=`echo $arg | sed "s/^-o//"`
		output_flag=2
	
	else
		newargs+="$arg "
	fi
done

