#!/bin/sh

case "$#" in
1)	MPRFILTER=cat;;
2)	if test ! -r "$2"; then
		echo "$1: error: cannot read $2" >&2
		exit 1
	fi
	if file "$2" | grep compress >/dev/null 2>&1; then
		MPRFILTER="gzip -dc $2"
	else
		MPRFILTER="cat $2"
	fi;;
*)	echo "usage: mprfilter prog [filename]" >&2
	exit 1;;
esac

echo "$MPRFILTER"
exit 0
