summaryrefslogtreecommitdiff
path: root/test/foomatic-test-renderer
blob: de3401e9bbd99328d1b3e5670655662cee13e681 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

# This is foomatic-test-renderer, a dummy renderer executable for testing
# and debugging foomatic-rip.

# To use it, create a test PPD file with lines like
#
# *cupsFilter:    "application/vnd.cups-postscript 0 foomatic-rip"
# *FoomaticRIPCommandLine: "foomatic-test-renderer%A%B%C%Z"
#
# and use foomatic-rip with this PPD file. If you do this via a print queue
# point the output of the queue into a file
#
# This program does nothing more than outputting the unchanged input data
# and after that the command line with which it was called in a PostScript
# comment (so one can still display the output as PostScript if the input
# was PostScript).
#
# With the option "-p OPTION=VALUE" supplied one or more times, a PJL
# header with appropriate options and also PJL to close the job will be added
# Supply "-p" in the end of the command line to generate a PJL header
# without option settings

commandline=$*

output="`cat`
% $0 $commandline"

pjl=0
while [ -n "$*" ]; do
    arg=$1
    shift
    if [ "$arg" = "-p" ]; then
	if [ "$pjl" = "0" ]; then
	    pjl=1
	    printf "\033%%-12345X"
	    #printf "@PJL\r\n"
	fi
	if [ -n "$1" ]; then
            printf "@PJL SET $1\r\n"
	    shift
	fi
    fi
done
if [ "$pjl" = "1" ]; then
    printf "@PJL ENTER LANGUAGE=POSTSCRIPT\r\n"
fi

echo "$output"

if [ "$pjl" = "1" ]; then
    printf "\033%%-12345X@PJL EOJ\r\n"
fi