/usr/bin/Fprint_template is in ferret-vis 6.9.3-4build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | #! /bin/sh
# Fprint
# Script to translate metafiles generated by Ferret. It runs either gksm2ps
# (on systems where Ferret uses xgks -- releases after Mar 1994), or mtt;
# please see the documentation on those. It is intended to simplify sending
# plots to printers, to an output file only, or to a workstation screen. This
# version translates to PostScript or Xwindow output.
#
# The script should work without modification to send output to the default
# printer at your site (whichever is specified in $PRINTER).
#
# The default behavior of this script is to translate metafiles to color PS (or
# grayscale) using line types appropriate for a monochrome PS printer.
#
# BUT the script should be modified to include the printers at your site.
# The section "MODIFY HERE" below contains case statements. Each case is
# intended to be the name of a printer at your site, and the options set
# for that case determines the default action taken by the metafile translator.
# For example, whether lines are rendered in color or b&w. The printers named
# in this template illustrate the use for supported device types.
#
# Examples of use:
#
# "Fprint metafile.plt" translates and prints 'metafile.plt' on $PRINTER
# "Fprint -P COLOR_PS metafile.plt" sends the plot to printer COLOR_PS
# "Fprint -o my_plot.ps metafile.plt" writes to a PS file named 'my_plot.ps'
# "Fprint -X metafile.plt" renders on the workstation screen.
#
# If you have questions please send email to davison@pmel.noaa.gov
# 12.15.94 Due to a bug in the DEC OSF lpr command, use of the -s (symbolic
# link, ie, don't copy the file -- used with large files) with the -r option
# (remove file after printing) cannot be done. The file is deleted before it
# printed. Consequently for OSF machines, I have dropped the use of the -r
# option and the print files will accumulate.
print_usage() {
if [ -n "$err_txt" ]; then
echo " "
echo "ERROR: You made a syntax error near $err_txt"
echo " "
fi
echo "Script to translate Ferret's graphics metafile(s) to PostScript"
echo "usage: Fprint [-P printer || -o file_name || -X]"
echo " [-p landscape || portrait] [-# <number of copies>]"
echo " [-l ps || cps] [-R] metafile(s)"
echo " "
echo " -P: send PostScript output to the named printer"
echo " -o: send PostScript output to a file and don't print the plots"
echo " -X: send the plots to your X Window for preview"
echo " -p: page orientation, landscape or portrait"
echo " -#: print more than one copy of the plots"
echo " -l: line styles, ps = monochrome, cps = color"
echo " -R: do not rename files with a date stamp appended (default is to stamp)"
echo " -C: Output a CMYK postscript file (default is RGB)"
echo "Examples: "
echo " Fprint metafile.plt*"
echo " Fprint -P our_color_printer -l cps -# 10 metafile.plt*"
echo " Fprint -p portrait -R metafile.plt.~2~"
}
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
print_usage
exit
fi
touch Fprint_output0.ps
rm -f Fprint_output*.ps
output_args=" "
output="printer"
printer_named=0
translator_args="-l cps -d cps"
gksm2ps_files=""
mtt_files=""
got_gksm2ps_files=0
got_mtt_files=0
REMOVE="-r"
# Pick off arguments til the end of the arguments
while [ $# != 0 ]; do
case "$1" in
# Send output to named printer
"-P")
shift
val=`echo $1 | cut -c1`
if [ "$val" = "-" ]; then
err_txt="-P $1"
print_usage
exit 1
fi
output_args="$output_args -P$1"
output="printer"
fprinter=$1
printer_named=1
shift
;;
# Output is to be directed to plot file and not printed
"-o")
shift
val=`echo $1 | cut -c1`
if [ "$val" = "-" ]; then
err_txt="-o $1"
print_usage
exit 1
fi
translator_args="$translator_args -o $1"
output="file"
shift
;;
# Output is to be directed to Xwindow
"-X")
shift
translator_args=""
output="Xwindow"
;;
# Print N copies
"-#")
shift
val=`echo $1 | cut -c1`
if [ "$val" = "-" ]; then
err_txt="-# $1"
print_usage
exit 1
fi
output_args="$output_args -#$1"
shift
;;
# Page orientation: landscape or portrait
"-p")
shift
val=`echo $1 | cut -c1`
if [ "$val" = "-" ]; then
err_txt="-p $1"
print_usage
exit 1
fi
if [ "$1" != "landscape" ] && [ "$1" != "portrait" ]; then
err_txt="-p $1"
print_usage
exit 1
fi
translator_args="$translator_args -p $1"
shift
;;
# Line color: cps (color) or ps (b&w)
"-l")
shift
val=`echo $1 | cut -c1`
if [ "$val" = "-" ]; then
err_txt="-l $1"
print_usage
exit 1
fi
if [ "$1" != "cps" ] && [ "$1" != "ps" ]; then
err_txt="-l $1"
print_usage
exit 1
fi
translator_args="$translator_args -l $1"
shift
;;
# Supported devices: cps (color PostScript) or phaser (TEK phaser ps)
"-d")
shift
val=`echo $1 | cut -c1`
if [ "$val" = "-" ]; then
err_txt="-d $1"
print_usage
exit 1
fi
if [ "$1" != "cps" ] && [ "$1" != "phaser" ]; then
err_txt="-d $1"
print_usage
exit 1
fi
translator_args="$translator_args -d $1"
shift
;;
# Don't append to metafiles with date stamp when translation is complete
"-R")
translator_args="$translator_args -R"
shift
;;
# Use CMYK color model
"-C")
translator_args="$translator_args -C"
shift
;;
# Everything else is passed to translator -- gotta be a file
*)
if [ ! -f $1 ]; then
echo " "
echo "ERROR: $1 is not a file name"
echo " "
print_usage
exit 1
fi
if head -n 1 $1 | grep -q "^GKSM" ; then
gksm2ps_files="$gksm2ps_files $1"
got_gksm2ps_files=1
else
mtt_files="$mtt_files $1"
got_mtt_files=1
fi
shift
;;
esac
done
if [ "$output" = "printer" ] && [ $printer_named -ne 0 ]; then
############################ MODIFY HERE ###################################
# Now set device characteristics for named printers
case "$fprinter" in
# If the printer is a color PS printer, use that device type
"COLOR_PS")
translator_args="$translator_args -l cps -d cps"
;;
# BUT If the printer is a PHASER PX with transfer sheets, type is "phaser"
"PHASER_PX_TRANSFER")
translator_args="$translator_args -l cps -d phaser"
;;
# The following example printers take the default options mentioned above.
"MONOCHROME_PS1")
;;
"MONOCHROME_PS2")
;;
"MONOCHROME_PS3")
;;
# The named printer is not a valid choice
*)
# This is the sort of message I anticipate the user getting
# if one names an unsupported printer:
#
# echo -n "'${fprinter}' is not a valid printer."
# if [ -n "$PRINTER" ]; then
# echo " The default printer is $PRINTER."
# else
# echo " "
# endif
# echo " Available printers are COLOR_PS, PHASER_PX_TRANSFER,"
# echo " MONOCHROME_PS1, MONOCHROME_PS2, and MONOCHROME_PS3"
#
# For now a user gets this message:
echo " "
echo " The Fprint script has not been set up to use the -P option"
echo " yet -- it should work with the default printer."
echo " "
exit
esac
##################### END OF "MODIFY HERE" SECTION ##########################
fi
# Now process the metafile(s) and print the plot file if appropriate
if [ `uname -s` = "OSF1" ]; then
REMOVE=""
fi
case $output in
"printer")
if [ $got_gksm2ps_files -ne 0 ]; then
gksm2ps -o Fprint_output1$$.ps $translator_args $gksm2ps_files
if [ -f Fprint_output1$$.ps ]; then
lpr -s ${REMOVE} $output_args ./Fprint_output1$$.ps
fi
fi
if [ $got_mtt_files -ne 0 ]; then
mtt -o Fprint_output2$$.ps $translator_args $mtt_files
if [ -f Fprint_output2$$.ps ]; then
lpr -s ${REMOVE} $output_args ./Fprint_output2$$.ps
fi
fi
;;
"file")
if [ $got_gksm2ps_files -ne 0 ]; then
gksm2ps $translator_args $gksm2ps_files
fi
if [ $got_mtt_files -ne 0 ]; then
mtt $translator_args $mtt_files
fi
;;
"Xwindow")
if [ $got_gksm2ps_files -ne 0 ]; then
gksm2ps -X $gksm2ps_files
fi
if [ $got_mtt_files -ne 0 ]; then
mtt $mtt_files
fi
;;
esac
|