updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / brother-dcp9010cn / brlpdwrapperdcp9010cn
blob960fb896dcb447b81ed98bec90482646425a60e3
1 #! /bin/sh
3 # Copyright (C) 2005 Brother. Industries, Ltd.
4 # Ver1.10
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the Free
8 # Software Foundation; either version 2 of the License, or (at your option)
9 # any later version.
11 # This program is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 # more details.
16 # You should have received a copy of the GNU General Public License along with
17 # this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18 # Place, Suite 330, Boston, MA 02111-1307 USA
21 LOGFILE="/dev/null"
22 LOGLEVEL="1"
23 LOGCLEVEL="7"
24 DEBUG=0
25 NUPENABLE=1
26 LOG_LATESTONLY=1
27 errorcode=0
29 if [ $DEBUG != 0 ]; then
30 LOGFILE=/tmp/br_cupsfilter_debug_log
33 PPDC=`printenv | grep "PPD="`
34 PPDC=`echo $PPDC | sed -e 's/PPD=//'`
36 if [ "$PPDC" = "" ]; then
37 PPDC="/usr/share/cups/model/brdcp9010cn.ppd"
41 if [ $LOGFILE != "/dev/null" ]; then
42 if [ $LOG_LATESTONLY == "1" ]; then
43 rm -f $LOGFILE
44 date >$LOGFILE
45 else
46 if [ -e $LOGFILE ]; then
47 date >>$LOGFILE
48 else
49 date >$LOGFILE
52 echo "arg0 = $0" >>$LOGFILE
53 echo "arg1 = $1" >>$LOGFILE
54 echo "arg2 = $2" >>$LOGFILE
55 echo "arg3 = $3" >>$LOGFILE
56 echo "arg4 = $4" >>$LOGFILE
57 echo "arg5 = $5" >>$LOGFILE
58 echo "arg6 = $6" >>$LOGFILE
59 echo "PPD = $PPD" >>$LOGFILE
62 INPUT_TEMP_PS=`mktemp /tmp/br_input_ps.XXXXXX`
64 nup="cat"
65 if [ "" != '' ] && [ $NUPENABLE != 0 ]; then
67 if [ "" != '' ]; then
68 nup="psnup -64"
69 elif [ "" != '' ]; then
70 nup="psnup -32"
71 elif [ "" != '' ]; then
72 nup="psnup -25"
73 elif [ "" != '' ]; then
74 nup="psnup -16"
75 elif [ "" != '' ]; then
76 nup="psnup -8"
77 elif [ "" != '' ]; then
78 nup="psnup -6"
79 elif [ "" != '' ]; then
80 nup="psnup -4"
81 elif [ "" != '' ]; then
82 nup="psnup -2"
83 elif [ "" != '' ]; then
84 nup="cat"
86 echo "NUP=$nup" >>$LOGFILE
87 if [ -e /usr/bin/psnup ]; then
88 if [ $# -ge 7 ]; then
89 cat $6 | $nup > $INPUT_TEMP_PS
90 else
91 cat | $nup > $INPUT_TEMP_PS
93 else
94 if [ $# -ge 7 ]; then
95 cp $6 $INPUT_TEMP_PS
96 else
97 cat > $INPUT_TEMP_PS
100 else
101 if [ $# -ge 7 ]; then
102 cp $6 $INPUT_TEMP_PS
103 else
104 cat > $INPUT_TEMP_PS
107 if [ -e "/usr/local/Brother/Printer/dcp9010cn/lpd/filterdcp9010cn" ]; then
109 else
110 echo "ERROR: /usr/local/Brother/Printer/dcp9010cn/lpd/filterdcp9010cn does not exist" >>$LOGFILE
111 errorcode=30
112 exit
115 CUPSOPTION=`echo "$5 Copies=1" | sed -e 's/BrMirror=OFF/MirrorPrint=OFF/' -e 's/BrMirror=ON/MirrorPrint=ON/' -e 's/BrChain/Chain/' -e 's/BrBrightness/Brightness/' -e 's/BrContrast/Contrast/' -e 's/BrHalfCut/HalfCut/' -e 's/BrAutoTapeCut/AutoCut/' -e 's/BrHalftonePattern/Halftone/' -e 's/Binary/Binary/' -e 's/Dither/Dither/' -e 's/ErrorDiffusion/ErrorDiffusion/' -e 's/BrSheets/Sheets/' -e 's/multiple-document-handling/Collate/' -e 's/separate-documents-collated-copies/ON/' -e 's/separate-documents-uncollated-copies/OFF/'`
116 if [ -e "/usr/local/Brother/Printer/dcp9010cn/cupswrapper/brcupsconfpt1" ]; then
117 if [ $DEBUG = 0 ]; then
118 /usr/local/Brother/Printer/dcp9010cn/cupswrapper/brcupsconfpt1 DCP9010CN $PPDC 0 "$CUPSOPTION" "dcp9010cn">> /dev/null
119 else
120 /usr/local/Brother/Printer/dcp9010cn/cupswrapper/brcupsconfpt1 DCP9010CN $PPDC $LOGCLEVEL "$CUPSOPTION" "dcp9010cn">>$LOGFILE
124 if [ $DEBUG -lt 10 ]; then
125 cat $INPUT_TEMP_PS | /usr/local/Brother/Printer/dcp9010cn/lpd/filterdcp9010cn "$$" "CUPS" "USB"
127 if [ $LOGLEVEL -gt 2 ]; then
128 if [ $LOGFILE != "/dev/null" ]; then
129 echo "" >>$LOGFILE
130 echo " ------PostScript Data-------" >>$LOGFILE
131 cat $INPUT_TEMP_PS >>$LOGFILE
135 rm -f $INPUT_TEMP_PS
137 exit