File dvitops of Package cups

#!/bin/sh
 
if test "$#" -lt "5"; then
        echo "ERROR: Number of arguments ($#) is wrong" 1>&2
        exit 1
fi
 
if test "$#" -gt "6"; then
        echo "ERROR: Number of arguments ($#) is wrong" 1>&2
        exit 1
fi
 
# Log the command line
echo dvitops: $@  1>&2
 
# Get the last parameter (which is the filename if present)
eval filename="\${$#}"
 
if [ -e $filename ]; then
  FILE_TO_PRINT=$filename;
else
  FILE_TO_PRINT="";
fi
 
if [ -z $FILE_TO_PRINT ]; then
  FILE_TO_PRINT=`mktemp -q /tmp/dvitops.XXXXXX`
  if [ $? -ne 0 ]; then
    echo "ERROR: Can't create temp file, exiting..." 1>&2
    exit 1
  fi
  trap "rm -f $FILE_TO_PRINT" EXIT SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM 
  cat >$FILE_TO_PRINT
fi
 
if  [ -z $FILE_TO_PRINT ]; then
  /usr/bin/dvips -q -f
else
  /usr/bin/dvips -q -f <$FILE_TO_PRINT
fi


openSUSE Build Service is sponsored by