home *** CD-ROM | disk | FTP | other *** search
/ tusportal.tus.k12.pa.us / tusportal.tus.k12.pa.us.tar / tusportal.tus.k12.pa.us / Wyse / latest-image.raw / 0.img / usr / lib / cups / filter / dvitops < prev    next >
Text File  |  2010-02-10  |  826b  |  42 lines

  1. #!/bin/sh
  2.  
  3. if test "$#" -lt "5"; then
  4.         echo "ERROR: Number of arguments ($#) is wrong" 1>&2
  5.         exit 1
  6. fi
  7.  
  8. if test "$#" -gt "6"; then
  9.         echo "ERROR: Number of arguments ($#) is wrong" 1>&2
  10.         exit 1
  11. fi
  12.  
  13. # Log the command line
  14. echo dvitops: $@  1>&2
  15.  
  16. # Get the last parameter (which is the filename if present)
  17. eval filename="\${$#}"
  18.  
  19. if [ -e $filename ]; then
  20.   FILE_TO_PRINT=$filename;
  21. else
  22.   FILE_TO_PRINT="";
  23. fi
  24.  
  25. if [ -z $FILE_TO_PRINT ]; then
  26.   FILE_TO_PRINT=`mktemp -q /tmp/dvitops.XXXXXX`
  27.   if [ $? -ne 0 ]; then
  28.     echo "ERROR: Can't create temp file, exiting..." 1>&2
  29.     exit 1
  30.   fi
  31.   trap "rm -f $FILE_TO_PRINT" EXIT SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM 
  32.   cat >$FILE_TO_PRINT
  33. fi
  34.  
  35. if  [ -z $FILE_TO_PRINT ]; then
  36.   /usr/bin/dvips -q -f
  37. else
  38.   /usr/bin/dvips -q -f <$FILE_TO_PRINT
  39. fi
  40.  
  41.  
  42.