ps2fax.dps.sh.in
上传用户:weiyuanprp
上传日期:2020-05-20
资源大小:1169k
文件大小:4k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. #! @SCRIPT_SH@
  2. # $Id: ps2fax.dps.sh.in,v 1.3 2008/01/09 06:40:35 faxguy Exp $
  3. #
  4. # HylaFAX Facsimile Software
  5. #
  6. # Copyright (c) 1990-1996 Sam Leffler
  7. # Copyright (c) 1991-1996 Silicon Graphics, Inc.
  8. # HylaFAX is a trademark of Silicon Graphics
  9. # Permission to use, copy, modify, distribute, and sell this software and 
  10. # its documentation for any purpose is hereby granted without fee, provided
  11. # that (i) the above copyright notices and this permission notice appear in
  12. # all copies of the software and related documentation, and (ii) the names of
  13. # Sam Leffler and Silicon Graphics may not be used in any advertising or
  14. # publicity relating to the software without the specific, prior written
  15. # permission of Sam Leffler and Silicon Graphics.
  16. # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  17. # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  18. # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  19. # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  20. # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  21. # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  22. # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  23. # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  24. # OF THIS SOFTWARE.
  25. #
  26. #
  27. # Convert PostScript to facsimile using DPS-based RIP for IRIX.
  28. #
  29. # ps2fax [-o output] [-l pagelength] [-w pagewidth]
  30. # [-r resolution] [-m maxpages] [-*] [file ...]
  31. #
  32. # We need to process the arguments to extract the input
  33. # files so that we can prepend a prologue file that defines
  34. # LaserWriter-specific stuff as well as to insert and error
  35. # handler that generates ASCII diagnostic messages when
  36. # a problem is encountered in the interpreter.
  37. #
  38. # NB: this shell script is assumed to be run from the
  39. #     top of the spooling hierarchy -- s.t. the etc directory
  40. #     is present.
  41. test -f etc/setup.cache || {
  42.     SPOOL=`pwd`
  43.     cat<<EOF
  44. FATAL ERROR: $SPOOL/etc/setup.cache is missing!
  45. The file $SPOOL/etc/setup.cache is not present.  This
  46. probably means the machine has not been setup using the faxsetup(@MANNUM1_8@)
  47. command.  Read the documentation on setting up HylaFAX before you
  48. startup a server system.
  49. EOF
  50.     exit 1
  51. }
  52. . etc/setup.cache
  53. PS=$DPSRIP
  54. jobid=
  55. fil=
  56. opt=
  57. while test $# != 0
  58. do case "$1" in
  59.     -i) shift; jobid=$1 ;;
  60.     -o) shift; opt="$opt -o $1" ;;
  61.     -l) shift; opt="$opt -l $1" ;;
  62.     -w) shift; opt="$opt -w $1" ;;
  63.     -r) shift; opt="$opt -r $1" ;;
  64.     -m) shift;; # NB: not implemented
  65.     -*) opt="$opt $1" ;;
  66.     *) fil="$fil $1" ;;
  67.     esac
  68.     shift
  69. done
  70. test -z "$fil" && fil="-" # read from stdin
  71. test -x $PS || {
  72.     cat<<EOF
  73. The DPS-based PostScript RIP does not exist on the server machine
  74. or is not located at the expected location:
  75.     $PS
  76. This indicates that you do not have hylafax.sw.dpsrip installed on
  77. the system or that it is installed in a nonstandard location.  This
  78. must be corrected before a PostScript document can be transmitted.
  79. EOF
  80.     exit 254; # cause document to be rejected
  81. }
  82. #
  83. # The sed work fixes bug in Windows-generated
  84. # PostScript that causes certain international
  85. # character marks to be placed incorrectly.
  86. #
  87. #    | $SED -e 's/yAscent Ascent def/yAscent 0 def/g' 
  88. #
  89. # NB: unfortunately it appears to break valid PostScript;
  90. #     so it's been disabled.
  91. #
  92. #
  93. # Apply customizations such as watermarking.   
  94. #
  95. if [ -f etc/FaxModify ]; then
  96.     . etc/FaxModify
  97. fi
  98. $CAT etc/dpsprinter.ps $fil | $PS $opt
  99. if [ $? -eq 2 ]; then
  100.     OS=`uname -r`
  101.     if expr $OS >= 6.2 >/dev/null; then
  102. cat<<EOF
  103. The DPS-based PostScript RIP is a COFF executable and cannot be used
  104. under IRIX $OS.  You must use a different RIP such as hylafax.sw.gsrip
  105. which is based on the freely distributed Ghostscript software distribution.
  106. EOF
  107. exit 254; # cause document to be rejected
  108.     fi
  109. fi