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 / ogonki < prev    next >
Text File  |  2010-02-10  |  1KB  |  51 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 ogonkify: $@  1>&2
  15.  
  16. # Get the last parameter (which is the filename if present)
  17. eval filename="\${$#}"
  18.  
  19. case "$CHARSET" in
  20.   iso-8859-1)    CMD="cat " ;;
  21.   iso-8859-2)    CMD="/usr/bin/ogonkify -AT -N " ;;
  22.   iso-8859-3)    CMD="/usr/bin/ogonkify -e L3 -AT -N " ;;
  23.   iso-8859-4)    CMD="/usr/bin/ogonkify -e L4 -AT -N " ;;
  24.   iso-8859-9)    CMD="/usr/bin/ogonkify -e L5 -AT -N " ;;
  25.   iso-8859-10)   CMD="/usr/bin/ogonkify -e L6 -AT -N " ;;
  26.   iso-8859-15)   CMD="/usr/bin/ogonkify -e L9 -AT -N " ;;
  27.   *) CMD="cat " ;;
  28. esac
  29.  
  30. if [ -e $filename ]; then
  31.   FILE_TO_PRINT=$filename;
  32. else
  33.   FILE_TO_PRINT="";
  34. fi
  35.  
  36. if [ -z $FILE_TO_PRINT ]; then
  37.   FILE_TO_PRINT=`mktemp -q /tmp/ogonki.XXXXXX`
  38.   if [ $? -ne 0 ]; then
  39.     echo "ERROR: Can't create temp file, exiting..." 1>&2
  40.     exit 1
  41.   fi
  42.   trap "rm -f $FILE_TO_PRINT" EXIT SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM 
  43.   cat >$FILE_TO_PRINT
  44. fi
  45.  
  46. if  [ -z $FILE_TO_PRINT ]; then
  47.   eval $CMD
  48. else
  49.   eval $CMD <$FILE_TO_PRINT
  50. fi
  51.