Initial lp.
This commit is contained in:
parent
9f1d53a09b
commit
6174642093
30 changed files with 1528 additions and 0 deletions
60
lp/process/psextract
Executable file
60
lp/process/psextract
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/local/plan9/bin/rc
|
||||
|
||||
# extract pages $OLIST from postscript on stdin
|
||||
|
||||
if(~ $OLIST '')
|
||||
exec cat
|
||||
|
||||
awk '
|
||||
BEGIN {
|
||||
x=ENVIRON["OLIST"];
|
||||
gsub(/^-o/, "", x);
|
||||
na = split(x, a, ",");
|
||||
header = 1;
|
||||
goodpage = 0;
|
||||
}
|
||||
|
||||
header || goodpage {
|
||||
print
|
||||
}
|
||||
|
||||
/^%%EndSetup[ ]*$/ { header = 0; next }
|
||||
|
||||
/^%%Page:/ {
|
||||
header = 0;
|
||||
p=$2+0;
|
||||
goodpage = 0;
|
||||
for(i=1; i<=na; i++){
|
||||
if(aa=match(a[i], "-")){
|
||||
low=substr(a[i], 1, RSTART);
|
||||
high=substr(a[i], RSTART+RLENGTH);
|
||||
if(low == "")
|
||||
low = 0;
|
||||
else
|
||||
low = low+0;
|
||||
if(high == "")
|
||||
high = 100000;
|
||||
else
|
||||
high = high+0;
|
||||
if(low <= p && p <= high){
|
||||
goodpage = 1;
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
if(a[i] == p){
|
||||
goodpage = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/^%%EndPage[ ]*$/ {
|
||||
goodpage = 0;
|
||||
}
|
||||
|
||||
/^%%Trailer[ ]*$/ {
|
||||
goodpage = 1;
|
||||
}
|
||||
|
||||
'
|
||||
Loading…
Add table
Add a link
Reference in a new issue