home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
ps
/
psdraft.zoo
/
psdraft
Wrap
Text File
|
1990-11-22
|
3KB
|
128 lines
=--==--===--====--=====--======--=======--======--=====--====--===--==--=
#!/bin/sh
# This is a shell archive. Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file". (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# psdraft
echo x - psdraft
sed -e 's/^X//' > "psdraft" << '//E*O*F psdraft//'
X#! /bin/sh
X#
X# Put the word "DRAFT" (or a specified word) on each page of a postscript
X# document.
X#
X# Usage:
X# psdraft -s draftstring file ...
X#
X#
X# Author: Spencer W. Thomas
X# Computer Science Dept.
X# University of Utah
X# thomas@cs.utah.edu
X#
X# Augmented to do grey string, choose font by:
X# James H. Cloos, Jr.
X# currently @ Milard Filmore College
X# State University of New York @ Buffalo
X# cloos@ACSU.Buffalo.EDU ; cloos@ub.UUCP
X#
X
X#
X# Insert header after first line that does not begin %% or %!
X#
X
Xtrap "rm -f /tmp/psd$$.*" 0 1 2 15
X
Xdraftstring=DRAFT
Xgreylevel=.85
Xdogrey=DRAFTO
Xfont=Helvetica-Bold
Xdodrafto=DRAFTO
Xdodraftg=
X
Xwhile getopts s:g:f: cc
Xdo
X case $cc in
X s) draftstring=$OPTARG;;
X g) greylevel=$OPTARG
X dodrafto=
X dodraftg=DRAFTG ;;
X f) font=$OPTARG;;
X \?) echo "Usage: psdraft [-s draftstring] files ..."
X exit 2;;
X esac
Xdone
X
Xshift `expr $OPTIND - 1`
X
X# Create sed script file
X
Xsed -e "s/(DRAFT)/($draftstring)/" \
X-e "s/(GREYLEVEL)/$greylevel/" \
X-e "s/ DODRAFTG / $dodraftg /" \
X-e "s/ DODRAFTO / $dodrafto /" \
X-e "s*/FONT*/$font*" <<'EOF' >/tmp/psd$$.sed
X1,/^[^%]/{
Xs/^%/%/
Xs/^$//
Xt skip
Xi\
X% Prelude to show a draft string on every page.\
X(DRAFT)\
X/DRAFTDICT 10 dict def\
XDRAFTDICT begin\
X/DRAFTSTRING exch def\
X/bd /FONT findfont def\
X/od bd maxlength 1 add dict def\
Xbd {exch dup /FID ne {exch od 3 1 roll put} {pop pop} ifelse} forall\
Xod /FontName /Outline0 put od /PaintType 2 put od /StrokeWidth 0 put\
X/Outline0 od definefont pop\
X/DRAFTO { gsave\
X initmatrix\
X /Outline0 findfont setfont\
X DRAFTSTRING dup stringwidth pop 8.875 exch div dup 72 mul dup scale\
X 52.3 rotate 2.5 exch div -.35 translate\
X 0 0 moveto show\
X grestore } def\
X/DRAFTG { gsave\
X initmatrix\
X /FONT findfont setfont (GREYLEVEL) setgray\
X DRAFTSTRING dup stringwidth pop 8.875 exch div dup 72 mul dup scale\
X 52.3 rotate 2.5 exch div -.35 translate\
X 0 0 moveto show\
X grestore } def\
X/oldshow /showpage load def\
X/oldcopy /copypage load def\
Xend\
X/showpage { DRAFTDICT begin DODRAFTO oldshow DODRAFTG end } def\
X/copypage { DRAFTDICT begin DODRAFTO oldcopy DODRAFTG end } def\
X% End of draft prelude
X: skip
X}
XEOF
X
Xcat $* | sed -f /tmp/psd$$.sed
//E*O*F psdraft//
echo Possible errors detected by \'wc\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
96 353 2169 psdraft
!!!
wc psdraft | sed 's=[^ ]*/==' | diff -b $temp -
exit 0
-==--==---==----==-----==------==-------==------==-----==----==---==--==-
Enjoy,
-JimC
--
James H. Cloos, Jr. Phone: +1 716 673-1250
cloos@ACSU.Buffalo.EDU Snail: PersonalZipCode: 14048-0772, USA
cloos@ub.UUCP Quote: <>