#! /bin/ksh
#
# This file is considered part of the software distribution,
# and any changes made to it may get overwritten in a    
# subsequent upgrade or reinstallation.  Instead of making
# changes here, directly, consider copying the entire
# default MIMEConverters directory to a custom location, i.e. 
# /usr/local/sbin/faxmail.custom, set MIMEConverters in     
# hyla.conf to point there, and make changes there instead.
#

GSRIP=gs
DEVICE=pswrite

. /usr/local/libdata/hylafax/etc/setup.cache

#
# Historically the pswrite device was used.  There were some
# reports that indicated that ps2write output looked better,
# and so for a time ps2write was used as a default, instead, 
# but apparently some Ghostscript releases had buggy ps2write 
# devices, and so we reverted to pswrite as a default.
# Ultimately Ghostscript abandoned and removed the pswrite 
# device entirely.  So we are obliged to use ps2write when
# the pswrite device is missing.  However, users who have 
# pswrite available to them may still want to evaluate 
# whether or not the ps2write device will produce better 
# output for them.
#
if [ -z "`$GSRIP -h | $GREP "\bpswrite\b"`" ]; then
    DEVICE=ps2write
else
    DEVICE=pswrite
fi

$GSRIP -q -dPDFFitPage -dBATCH -dNOPAUSE \
    -sDEVICE=$DEVICE -sOutputFile=- "$1"

exit
