#!/bin/sh if [ ${#} -ne "1" ]; then echo "Usage: ${0} " exit 1 fi # check our requirements type wvPS 2>&1 >/dev/null if [ ${?} -ne "0" ]; then echo "Error: required program 'wvPS' was not found" exit 1 fi # viewer application GV="" # check for gnome ghost-view first type ggv 2>&1 >/dev/null if [ ${?} -eq "0" ]; then GV="ggv" else # TODO: does kde have something? # try to default back onto gv type gv 2>&1 >/dev/null if [ ${?} -eq "0" ]; then GV="gv" else # old solaris systems type ghostview 2>&1 >/dev/null if [ ${?} -eq "0" ]; then GV="ghostview" else # unrecoverable error echo "Could not find a suitable PostScript viewer." echo "Please install ggv, gv, or ghostview" exit 1 fi fi fi # temporary PS file, mangled to get some sort # of semi-uniqueness FILE=`basename ${1}` TMPPS="/tmp/${FILE}-${USER}-${$}.ps" wvPS ${1} ${TMPPS} if [ ${?} -ne "0" ]; then echo "Could not translate into Postscript" exit 1 fi # call our ghost-viewer exec "${GV} ${TMPPS}" exit ${?}