aboutsummaryrefslogtreecommitdiff
path: root/lp/process/generic
blob: 3b793d2fa8bae41a8aefb50d0fa35fb8fb9d206f (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/local/plan9/bin/rc
# Tries to determine what type of file you are printing and do the correct
# thing with it.
# It currently knows about images, troff intermediate, and ascii files.
TMPFILE=/tmp/lp$pid
fn sigexit { rm -f $TMPFILE; }
if (! ~ $DEBUG '') flag x +
if (~ $LPCLASS *nohead*) NOHEAD=1
if (~ $LPCLASS *duplex*) DUPLEX=1
cat >$TMPFILE
FILETYPE=`{file $TMPFILE}
switch ($FILETYPE(2)) {
case troff;
	switch ($LPCLASS) {
	case *Latin1* *post* *opost*;	switch ($FILETYPE(5)) {
					# Latin1 is for compatibility with old research UNIX systems, doesn't work on Plan 9
					case Latin1 post; tcs -s -f utf -t latin1 < $TMPFILE |$LPLIB/process/dpost

					case UTF; $LPLIB/process/tr2post < $TMPFILE
					}

	case *;		echo $FILETYPE(2) -T$FILETYPE(5) output is improper for $LPDEST >[1=2]
	}
case special;
	switch ($FILETYPE(4)) {
	case '#b';		switch ($LPCLASS) {
				case *post*;	$LPLIB/process/p9bitpost < $TMPFILE
				}

	case *;		echo $FILETYPE file is improper for $LPDEST >[1=2]
	}
case Compressed plan old;	# type is really 'Compressed image' or 'plan 9 image' 
				# or 'old plan 9 image'
	switch ($LPCLASS) {
	case *post*;	$LPLIB/process/p9bitpost < $TMPFILE
	}
case jpeg;
	switch ($LPCLASS) {
	case *post*;	$LPLIB/process/jpgpost < $TMPFILE
	}

case GIF;
	switch ($LPCLASS) {
	case *post*;	$LPLIB/process/gifpost < $TMPFILE
	}

case ccitt-g31;
	switch ($LPCLASS) {
	case *post*;	$LPLIB/process/g3post < $TMPFILE
	}

# bitmap for research UNIX compatibility, does not work on Plan 9.
case bitmap;
	switch ($LPCLASS) {
	case *post*;	$LPLIB/process/bpost < $TMPFILE
	case *mhcc*;	$LPLIB/process/bpost < $TMPFILE | $LPLIB/process/mhcc
	case *;		echo $FILETYPE(2) file is improper for $LPDEST >[1=2]
	}
case tex;
	mv $TMPFILE $TMPFILE.dvi
	TMPFILE=$TMPFILE.dvi
	switch ($LPCLASS) {
	case *post*;	$LPLIB/process/dvipost $TMPFILE
	case *;		echo $FILETYPE(2) file is improper for $LPDEST >[1=2]
	}
case postscript;
	switch ($LPCLASS) {
	case *post*;		$LPLIB/process/post < $TMPFILE
	case *;			echo $FILETYPE(2) file is improper for $LPDEST >[1=2]
	}
case HPJCL;
	switch ($LPCLASS) {
	case *HPJCL*;		$LPLIB/process/noproc < $TMPFILE
	case *;			echo $FILETYPE(2) file is improper for $LPDEST >[1=2]
	}
case daisy;
	switch ($LPDEST) {
	case *;		echo $FILETYPE(2) file is improper for $LPDEST >[1=2]
	}
case English short extended alef limbo [Aa]scii ASCII assembler c latin rc sh as mail email message/rfc822;
	switch ($LPCLASS) {
	case *post*;	$LPLIB/process/ppost < $TMPFILE
	case *canon*;	$LPLIB/process/can $* < $TMPFILE
	case *;		echo Unrecognized class of line printer for $LPDEST >[1=2]
	}

case tiff;
	switch ($LPCLASS) {
	case *post*;	$LPLIB/process/tiffpost $TMPFILE
	case *;		echo Unrecognized class of line printer for $LPDEST >[1=2]
	}
case PDF;
	switch ($LPCLASS) {
	case *post*;	$LPLIB/process/pdfpost $TMPFILE
	case *;		echo Unrecognized class of line printer for $LPDEST >[1=2]
	}
case empty;
	echo file is empty >[1=2]
case cannot;
	echo cannot open file >[1=2]
case *;
	echo $FILETYPE(2) file is improper for $LPDEST >[1=2]
}
wait
rv=$status
rm -f $TMPFILE
#exit $status
exit