From Bradley Spatz, University of Florida.
-----------------------------------------

This file describes the UF CIS dept. modifications & enhancements to the
gopher distribution from the University of Minnesota and Xgopher from
the University of Illinois.

gopher-display-image: 24Feb93, sag

Author: Bradley C. Spatz, bcs@cis.ufl.edu

Enhancements: Scott Glenn, sag@cis.ufl.edu

This is a perl(1) script which chooses an image display program
based on the extension of the filename passed to it.  In this way
we were able to extend the scope of the "Image" file type
to include PostScript (.ps) and DVI (.dvi) files.

Of course, the references to the image command must be changed.

In the X resources:

Xgopher.imageCommand:   /local/bin/gopher-display-image

If you administer the gopher server, you can teach it to recognize
different image file formats automatically, or use .cap files to
describe each file as a type 'I'.
To teach the server you must also change the "gopherd.conf" to indicate
the additional image file formats gopher-display-image supports.  In our case:

ext: .ps I 9 Postscript
ext: .dvi I 9 DVI

This is necessary so that DVI and PostScript files will be recognized as
images and thus passed to gopher-display-image, not the standard pager
or text window.

===========================================================================
= gopher-display-image                                                    =
===========================================================================
#!/local/bin/perl
#
# gopher-display-image
#
# A script which chooses an image display program based on the filename
# extension of its argument (the file to be displayed).
#
# Last edited: Tue Feb 23 18:59:00 1993 by sag (Scott Glenn) on crane
#
# Check for a parameter: the file[name] to display.
#
if (! $ARGV[0]) {
	print "image-wrapper: no filename specified!\n";
	exit 1;
}
#
# Now determine the extension (and thus the type) of the file.
#
$dot = rindex($ARGV[0], ".");
if ($dot > 0) {
	$ext = substr($ARGV[0],($dot + 1));
}
else {
	print "image-wrapper: no extension parsed from $ARGV[0]\n";
	exit 2;
}
#
# Now run a program to display the image, depending on the extension.
#
if ($ext eq "ps") {
	exec "gv -magstep 3 $ARGV[0]";
}
elsif ($ext eq "dvi") {
	exec "xdvi $ARGV[0]";
}
else {
	exec "xv $ARGV[0]";
}
-- END gopher-display-image --
