author | Mike Sullivan <Mike.Sullivan@Oracle.COM> |
Wed, 29 Aug 2012 11:05:56 -0700 | |
changeset 957 | 255465c5756f |
parent 178 | 4340c0d63702 |
permissions | -rw-r--r-- |
178
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
1 |
#!/bin/sh |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
2 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
4 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
8 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
13 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
19 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
21 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
22 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
23 |
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
24 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
25 |
# To configure this interface script under Solaris LP use the following |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
26 |
# command: |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
27 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
28 |
# lpadmin -p printer -v /dev/... -I"postscript,pdf" -Tunknown \ |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
29 |
# -i /usr/sfw/share/ghostscript/interfaces/GSinterface \ |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
30 |
# -o GS_DEVICE=(gs-device-type) \ |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
31 |
# [-o OutputFile=(file/device)] [-o PAPERSIZE=(size)] \ |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
32 |
# [-o RESOLUTION=XxY] [-o banner-type=(ascii|postscript)] \ |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
33 |
# [-o GS_OPTIONS="-sIjsServer=... -sIjsParams=..."] |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
34 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
35 |
# see gs(1) for more information about values that can be used for |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
36 |
# GS_DEVICE, PAPERSIZE, and RESOLUTION, and GS_OPTIONS. |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
37 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
38 |
# There is a known problem printing through a /dev/lp? parallel port |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
39 |
# on a Solaris x86 machine. If you have selected the correct GS_DEVICE |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
40 |
# and get garbled output when printing under this configuration, running |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
41 |
# "lpadmin -p printer -H nopush" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
42 |
# should fix the problem. |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
43 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
44 |
PATH=/usr/sfw/bin:/usr/lib/lp/bin:/bin export PATH |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
45 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
46 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
47 |
if [ $# -lt 5 ] ; then |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
48 |
logger -p lpr.err -t "GSinterface" \ |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
49 |
"wrong number of arguments to interface program" 1>&2 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
50 |
logger -p lpr.err -t "GSinterface" "$0 $*" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
51 |
echo "wrong number of arguments to interface program" 1>&2 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
52 |
exit 1 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
53 |
fi |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
54 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
55 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
56 |
printer=`basename $0` |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
57 |
request_id=$1 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
58 |
user_name=$2 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
59 |
title=$3 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
60 |
copies=$4 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
61 |
option_list=$5 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
62 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
63 |
shift 5 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
64 |
files="$*" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
65 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
66 |
tag="GSinterface: ${request_id}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
67 |
error_file="/tmp/${printer}-log.$$" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
68 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
69 |
logger -p lpr.debug -t ${tag} "INPUT" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
70 |
logger -p lpr.debug -t ${tag} " printer : ${printer}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
71 |
logger -p lpr.debug -t ${tag} " request_id : ${request_id}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
72 |
logger -p lpr.debug -t ${tag} " user_name : ${user_name}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
73 |
logger -p lpr.debug -t ${tag} " title : ${title}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
74 |
logger -p lpr.debug -t ${tag} " copies : ${copies}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
75 |
logger -p lpr.debug -t ${tag} " option_list : ${option_list}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
76 |
logger -p lpr.debug -t ${tag} " files : ${files}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
77 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
78 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
79 |
parse () { |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
80 |
echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
81 |
} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
82 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
83 |
banner="postscript_banner" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
84 |
nobanner="no" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
85 |
nofilebreak="no" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
86 |
OutputFile= |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
87 |
GS_DEVICE=nullpage |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
88 |
GS_OPTIONS= |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
89 |
inlist= |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
90 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
91 |
for i in ${option_list} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
92 |
do |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
93 |
case "${inlist}${i}" in |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
94 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
95 |
nobanner ) |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
96 |
nobanner="yes" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
97 |
;; |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
98 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
99 |
nofilebreak ) |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
100 |
nofilebreak="yes" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
101 |
;; |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
102 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
103 |
banner-type=* ) |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
104 |
banner="`parse ${i}`_banner" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
105 |
;; |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
106 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
107 |
GS_DEVICE=* ) |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
108 |
GS_DEVICE=`parse ${i}` |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
109 |
;; |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
110 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
111 |
OutputFile=* ) |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
112 |
GS_OPTIONS="-sOutputFile=`parse ${i}` ${GS_OPTIONS}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
113 |
OutputFile="yes" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
114 |
;; |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
115 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
116 |
RESOLUTION=* ) |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
117 |
GS_OPTIONS="-r`parse ${i}` ${GS_OPTIONS}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
118 |
;; |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
119 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
120 |
PAPERSIZE=* ) |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
121 |
GS_OPTIONS="-sPAPERSIZE=`parse ${i}` ${GS_OPTIONS}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
122 |
;; |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
123 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
124 |
GS_OPTIONS=* ) |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
125 |
GS_OPTIONS="`parse ${i}` ${GS_OPTIONS}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
126 |
;; |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
127 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
128 |
* ) |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
129 |
logger -p lpr.error -t ${tag} \ |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
130 |
"unrecognized \"-o ${i}\" option, ignored" 1>&2 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
131 |
;; |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
132 |
esac |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
133 |
done |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
134 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
135 |
if [ "${OutputFile}" = "" ] ; then |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
136 |
GS_OPTIONS="-sOutputFile=- ${GS_OPTIONS}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
137 |
fi |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
138 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
139 |
# Don't pause between pages, exit upon completion, don't print startup and |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
140 |
# page messages, don't allow deletefile, rename, or write access to files |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
141 |
GS_OPTIONS="-dNOPAUSE -dBATCH -dQUIET -dSAFER ${GS_OPTIONS}" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
142 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
143 |
export GS_DEVICE GS_OPTIONS PATH |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
144 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
145 |
logger -p lpr.debug -t ${tag} "ENVIRONMENT" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
146 |
env | logger -p lpr.debug -t "${tag}: " |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
147 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
148 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
149 |
# Generate an ASCII banner page and pass it to the printer |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
150 |
# This is much faster than the PostScript(TM) banner |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
151 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
152 |
ascii_banner() { |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
153 |
cat <<EOF |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
154 |
${title} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
155 |
Request: ${request_id} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
156 |
User: ${user_name} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
157 |
Printer: ${printer} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
158 |
Time: `date` |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
159 |
Copies: ${copies} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
160 |
EOF |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
161 |
tput ff |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
162 |
} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
163 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
164 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
165 |
# Generate a PostScript(TM) banner page and run it through GhostScript. |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
166 |
# This assumes an 8.5x11 page size. |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
167 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
168 |
postscript_banner() { |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
169 |
cat <<EOF | gs - 2>> ${error_file} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
170 |
%!ps |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
171 |
/PrintLine { exch findfont exch scalefont setfont moveto show } def |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
172 |
newpath 4 setlinewidth 1 setlinejoin |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
173 |
15 760 moveto 595 760 lineto 595 585 lineto 15 585 lineto closepath |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
174 |
gsave .75 setgray fill grestore |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
175 |
0 setgray stroke |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
176 |
(${user_name}) 30 730 /Times-Bold 24 PrintLine |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
177 |
(${request_id}) 415 730 /Times-Bold 24 PrintLine |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
178 |
(${printer}) 30 600 /Times-Bold 16 PrintLine |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
179 |
(`date`) 350 600 /Times-Roman 16 PrintLine |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
180 |
(${title}) 100 660 /Times-Bold 36 PrintLine |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
181 |
(Copies: ${copies}) 30 25 /Times-Roman 16 PrintLine |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
182 |
showpage |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
183 |
EOF |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
184 |
} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
185 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
186 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
187 |
# should create a banner |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
188 |
# a simple text or PCL banner would be prefered, because a PS one |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
189 |
# would require GhostScript to RIP and pass the whole image to the |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
190 |
# printer. |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
191 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
192 |
case "${nobanner}" in |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
193 |
"no") |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
194 |
(eval "${banner}" 1>&3 2>&1) | lp.cat 0 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
195 |
;; |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
196 |
esac |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
197 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
198 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
199 |
# process the files |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
200 |
# |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
201 |
i=1 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
202 |
while [ $i -le $copies ] ; do |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
203 |
for file in $files ; do |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
204 |
gs $file 2>> ${error_file} | lp.cat 0 |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
205 |
done |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
206 |
i=`expr $i + 1` |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
207 |
done |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
208 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
209 |
if [ -s ${error_file} ] ; then |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
210 |
logger -p lpr.debug -t ${tag} "GS ERRORS" |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
211 |
cat ${error_file} | logger -p lpr.debug -t "${tag}: " |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
212 |
rm -f ${error_file} |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
213 |
fi |
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
214 |
|
4340c0d63702
7019309 move ghostscript to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
215 |
exit 0 |