From: rick@digibd.COM (Rick Richardson)
Subject: Re: Not quite quiet
Organization: DigiBoard Incorporated, Eden Prairie, MN
Distribution: gnu
Date: Sat, 29 Aug 1992 16:11:13 GMT

>In article <BtJG9u.DME@olsen.ch> lichtin@olsen.CH (Martin Lichtin) writes:
>> I'm calling GhostScript 2.41 from within other programs, so
>> GhostScript should not issue any text if everything goes fine.
>> Unfortunately, using the following
>>
>>    gs -dNOPAUSE -q -sDEVICE=dfaxhigh -sOUTPUTFILE='fax.%d' file.ps
>>
>> still generates the 'GS>' prompt on stdout. Is there a way to avoid
>> this?

Here's the handy "wrapper" we use around here to convert .ps
files to DigiFAX fax files, as well as for printing to a LaserJet.

BTW, there's absolutely no reason to use the 'fax.%d' file naming
convention for DigiFAX output files.  The DigiFAX format supports
multiple pages per file.

-Rick

:
#
#	ps2fax,ps2laserjet,ps2epson,ps2ljet2p,ps2ljet3:
#
#	This script converts postscript to fax.
#	It requires that Ghostscript v2.4 or later be installed on your system.
#
#	You may also link this script to:
#		ps2laserjet
#		ps2ljet2p
#		ps2ljet3
#		ps2epson
#	These versions produce output ready for those types of printers
#
#	- Rick Richardson, DigiBoard, Inc.
#

#
#	Various configurable variables
#

#	Places to find gs binary (a colon separated list of paths).
GS_BIN=/usr/local/bin

#	Places to find gs startup code and supporting files
GS_START=/usr/local/lib/ghostscript

#	Places to find gs fonts (a colon separated list of paths).
GS_FONTS=/usr/local/lib/ghostscript/fonts

#	Places to find Adobe fonts (a colon separated list of paths).
AD_FONTS=/usr/local/lib/ghostscript/fonts-adobe

#	Default fonts.  Set to either $GS_FONTS or $AD_FONTS
DEF_FONTS=$GS_FONTS

#	Options to make gs be silent
SILENT="-q -dNOPAUSE"

#	Any other options to pass to gs
GS_OPTS=

#
#	Determine what program we really are if linked to some other name
#
IAM=`basename "$0"`
case "$IAM" in
ps2laserjet|ps2pcl)
	Device=-sDEVICE=laserjet;
	DevName="LaserJet Series II printer"
	OutFile="-sOUTPUTFILE=|cat"
	;;
ps2ljet2p)
	Device=-sDEVICE=ljet2p;
	DevName="LaserJet Series IIP printer"
	OutFile="-sOUTPUTFILE=|cat"
	;;
ps2ljet3)
	Device=-sDEVICE=ljet3;
	DevName="LaserJet Series III printer"
	OutFile="-sOUTPUTFILE=|cat"
	;;
ps2epson)
	Device=-sDEVICE=epson;
	DevName="Epson printer"
	OutFile="-sOUTPUTFILE=|cat"
	;;
*)
	Device=-sDEVICE=dfaxhigh;
	DevName="DigiFAX fax"
	OutFile="-sOUTPUTFILE=ps2fax.fax"
	;;
esac

#
#	Usage message
#
usage() {
	cat <<EOF
Usage: $IAM [-l] [-ag] [ -o OUTFILE ] ps_files...

Converts Postscript file(s) to $DevName format using Ghostscript.
Requires that Ghostscript with the $Device devices be installed.
If no OUTFILE is specified, the output appears on standard output
for printers, or put into file "ps2fax.fax" for FAX.

The default font files are found in $DEF_FONTS.

Options:
-a		Force use of Adobe fonts.
		(in $AD_FONTS)
-g		Force use of GNU fonts.
		(in $GS_FONTS)
-l		Produce low resolution FAX output
-o OUTFILE	Names the file that contains the output
EOF
}

#
#	Process options
#
UseFonts=default
set -- `getopt ?aglo:r: $*`
if [ $? != 0 ]; then usage; exit 2; fi
for i in $*
do
	case $i in
	-l)		Device="-sDEVICE=dfaxlow"; shift;;
	-a)		UseFonts=adobe; shift;;
	-g)		UseFonts=gnu; shift;;
	-o)		OutFile="-sOUTPUTFILE=$2"; shift; shift;;
	-r)		GS_OPTS="$GS_OPTS -r$2"; shift; shift;;
	--)		shift; break;;
	-?)		usage; exit 0;;
	esac
done

#
#	Now, set up paths and variables
#
case $UseFonts in
adobe)	GS_LIB=$AD_FONTS:$GS_START;;
gnu)	GS_LIB=$GS_FONTS:$GS_START;;
*)	GS_LIB=$DEF_FONTS:$GS_START;;
esac

PATH=$GS_BIN:$PATH;
export PATH GS_LIB

#
#	Now do the real work by calling "gs"
#
files="$*"
if [ "Q$files" = Q ]
then
	exec gs $SILENT $Device $GS_OPTS $OutFile -
else
	exec gs $SILENT $Device $GS_OPTS $OutFile $files quit.ps
fi
-- 
Rick Richardson		Email: rick@digibd.com	This space intentionally
Senior Staff Engineer	Fax:   (612) 943-0803	blank until 1996 elections.
DigiBoard, Inc.		Tel:   (612) 943-5383
Eden Prairie, MN	Radio: N0NMY

Newsgroups: gnu.ghostscript.bug