TMP=`getopt -o i:p -- "$@" 2>/dev/null`
if [ $? -ne 0 ] ; then
	echo >& 2 'Option error'
	usage
	exit 1
fi
eval set -- "$TMP"
while [ $1 != '--' ] ; do
	case "$1" in
	-i)
		from=$2
		shift
		;;
	-p)
		action=preview
		;;
	*)
		echo >&2 'unknown switch:' $1
		exit 1
		;;
	esac
	shift
done
shift

if [ $# -lt 1 ] ; then
	echo >&2 'need input file(s)'
	exit 1
fi

if [ -z $from ] ; then
	echo >&2 'what is the input codec?'
	exit 1
fi

for f in "$@" ; do
	$action $from "$f" '.utf8.tmp' '.backup'
done
