NAME
cpsencode - Embed shell scripts and data files in Complete
PostScript (CPS) file
SYNOPSIS
cpsencode shell-script [ -e ] [ -u ] [ -v ] >> PostScript-
file
NAME
cpsdecode - Extract shell scripts and data files from Com-
plete PostScript (CPS) file
SYNOPSIS
cpsdecode [ PostScript-file ] [ -e ] [ -u ] [ -v ]
DESCRIPTION
cpsencode takes a shell-script file as argument and will
write its contents as well as the contents of any data files
referred to in the script to standard output, which you
append to the PostScript file. These lines are started with
the PostScript comment %%CPS which is used by cpsdecode to
unscramble the script and data files at a later time. The
latter reads the PostScript file from stdin if no file is
given.
-e Leave unencoded. Files are not decoded from ASCII to
binary or encoded from binary to ASCII. Requires -u
and that all data files are ASCII.
-u Leave uncompressed. Files are not compressed prior to
the encode stage or decompressed after the encode
stage.
-v Verbose. Report the progress of encoding/decoding the
script and any data files referred to in the script
[Default is silent].
SPECIAL
A special mechanism is available if you want to embed files
that are not directly used by the script. These could be
hidden files that some commands will read implicitly (say, a
.cshrc file) or related documentation files that cannot be
executed in the script. You can import such files by adding
the script comment
#CPS: filename
You will need one such line for each file you require. Any
file is only written once so repeated references to the same
file by the script or this special mechanism will only
result in one import.
EXAMPLES
Let us say you have a cshell script called Figure_8.csh
which creates the PostScript file Figure_8.ps. Figure_8.csh
operates on several data files in order to make the plot.
You turn this plot file into a Complete PostScript (CPS)
file with the command
cpsencode -v Figure_8.csh >> Figure_8.ps
Alternatively, let that be the last command in the script so
that it is automatically done by the script itself.
To unscramble the CPS file, simply say
cpsdecode -v Figure_8.ps
BUGS
cpsencode assumes good script etiquette so that any tem-
porary files created by your script are removed before
cpsencode is called. Otherwise they will take up unnec-
cesary space in the Complete PostScript (CPS) file. cpsen-
code will have trouble if you script changes directories
with the cd command since filenames become relative to
another directory. Using absolute paths name for files
(starting with /, ~/. or ~user/) is bad practice since other
users may not be able to access those files.
AUTHOR
Paul Wessel, Geology & Geophysics, SOEST, University of
Hawaii, 1680 East-West Road, Honolulu HI 96822, USA.
www.soest.hawaii.edu/wessel.