]> git.lizzy.rs Git - plan9front.git/blob - sys/lib/lp/process/ppost
rootstub: create /sys/src/pkg and /sys/lib/pkg directories
[plan9front.git] / sys / lib / lp / process / ppost
1 #!/bin/rc
2 # converts a regular text file to PostScript
3 if (! ~ $DEBUG '') flag x +
4 PATCH='%%Patch from lp'
5 switch ($LPCLASS) {
6 case *hp4simx*;
7         PATCH=$PATCH'
8 %% set the default papertray to be the lower tray for HP4siMX printers
9         statusdict begin defaultpapertray end 1 ne {
10                 statusdict begin
11                         1 setdefaultpapertray
12                 end
13         } if'
14 }
15 for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
16         switch ($i) {
17         case -P*;
18         case man manual manualfeed;
19                 PATCH=$PATCH'
20 %%BeginFeature: *Select ManualFeed
21 [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
22     << /ManualFeed true >> setpagedevice
23    } {statusdict begin /manualfeed true def end} ifelse
24  } stopped cleartomark
25 %%EndFeature'
26         case simplex;
27                 DUPLEX=0
28         case [0-9];
29                 PATCH=$PATCH'
30 %%BeginFeature: *Select InputTray
31 [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
32         << '$i' << /MediaType (tray'$i') >> >>
33     << /MediaType (tray'$i') >> setpagedevice
34    } {statusdict begin '$i' setpapertray end} ifelse
35  } stopped cleartomark
36 %%EndFeature'
37         case 11x17 [Ll]edger;
38                 PATCH=$PATCH'
39 %%BeginFeature: *Select Ledger
40 [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
41     << /PageSize [792 1224] >> setpagedevice
42    } {statusdict begin '$i'tray end} ifelse
43  } stopped cleartomark
44 %%EndFeature'
45         case transparency vg viewgraph;
46                 PATCH=$PATCH'
47 %%BeginFeature: *Select Transparency
48 [{ << /MediaType (Transparency) >> setpagedevice
49  } stopped cleartomark
50 %%EndFeature'
51         case *;
52                 echo illegal option ''''-i $i'''' >[1=2]
53         }
54 }
55 if (! ~ $#DUPLEX 0) {
56         switch ($DUPLEX) {
57         case 0;
58                 DUPLEX=false
59         case 1;
60                 DUPLEX=true
61         }
62         PATCH=$PATCH'
63 %%BeginFeature: *Set DuplexMode
64 [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
65     << /Duplex '$DUPLEX'  >> setpagedevice
66   } {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
67  } stopped cleartomark
68 %%EndFeature'
69 }
70 PATCH=$PATCH'
71 %%EndPatch from lp
72 '
73 if (! ~ $PATCH '' -P*)
74         PATCH=-P''''$PATCH'''';
75 switch ($LAND) {
76 case -p*;
77 case ''; LAND=-pp
78 case 1; LAND=-pl
79 }
80 if (! ~ $COPIES '' -c*) COPIES=-c^$COPIES
81 switch ($FONT) {
82 case ''; FONT=-f'Courier'
83 case -f*;
84 case *; FONT=-f$FONT
85 }
86 switch ($POINT) {
87 case ''; POINT=-s10
88 case -s*;
89 case *; POINT=-s$POINT
90 }
91 if (! ~ $LINES '' -l*) LINES=-l^$LINES;
92 if (! ~ $MAG '' -m*) MAG=-m^$MAG;
93 if (! ~ $NPAG '' -n*) NPAG=-n^$NPAG;
94 if (! ~ $XOFF '' -x*) XOFF=-x`{echo $XOFF + .4|hoc};
95 if not XOFF=-x.4
96 if (! ~ $YOFF '' -y*) YOFF=-y^$YOFF;
97 eval  /$cputype/bin/aux/text2post $FONT $XOFF $YOFF $COPIES $LINES $MAG $NPAG $POINT $LAND $OLIST $PATCH | $LPLIB/process/hpost
98 # eval /$cputype/bin/aux/postprint -EUTF $FONT $XOFF $YOFF $COPIES $LINES $MAG $NPAG $POINT $LAND $OLIST $PATCH | $LPLIB/process/hpost
99 exit