#
# Tells chimera how to deal with different types of files
#
# access fileid method
#
# access is one of *, http gopher, ftp, cimg, mimg, gimg
#   * will match any access
#   ftp, gopher, http are the usual access methods
#   cimg tells what to do with img on a color screen (kludge)
#   mimg tells what to do with img on a monochrome screen (kludge)
#   gimg tells what to do with img on a grayscale screen (kludge)
#
# fileid can be anything to match the filename.
#   ^ as the first character means the comparison starts at the beginning
#   this will also match a MIME content-type if one is available
#   this is access method dependent.  for example, look at the gopher
#   entries.  this field is case insensitive.
#   * will match everything.
#
# method is how the file should be modified.
#   ! followed by a command indicates that an external command should be used.
#   | open a pipe to the process and read from it.
#   text indicates that the file is text (internal id)
#   html indicates that the file is html (internal id)
#   unknown indicates that the file is an unknown type (internal id)
#

#
# For the image conversion stuff, ppmquant can be used to limit the
# colors per image so documents with many images can be displayed.
#

#
# monochrome image conversion stuff for <img>
#
mimg    ^image/gif |giftoppm %s 2> /dev/null | ppmtopgm 2> /dev/null | pgmtopbm 2> /dev/null
mimg    ^image/xbm |xbmtopbm %s 2> /dev/null
mimg    ^image/x-xbitmap |xbmtopbm %s 2> /dev/null
#
mimg    .gif       |giftoppm %s 2> /dev/null | ppmtopgm 2> /dev/null | pgmtopbm 2> /dev/null
mimg    .xbm       |xbmtopbm %s 2> /dev/null
#

#
# grayscale image conversion stuff for <img>
#
gimg    ^image/gif |giftoppm %s 2> /dev/null | ppmtopgm 2> /dev/null
gimg    ^image/xbm |xbmtopbm %s 2> /dev/null
gimg    ^image/x-xbitmap |xbmtopbm %s 2> /dev/null
#
gimg    .gif       |giftoppm %s 2> /dev/null | ppmtopgm 2> /dev/null
gimg    .xbm       |xbmtopbm %s 2> /dev/null

#
# color image conversion stuff for <img>
#
cimg    ^image/gif |giftoppm %s 2> /dev/null
cimg    ^image/xbm |xbmtopbm %s 2> /dev/null
cimg    ^image/x-xbitmap |xbmtopbm %s 2> /dev/null
#
cimg    .gif       |giftoppm %s 2> /dev/null
cimg    .xbm       |xbmtopbm %s 2> /dev/null

#
# Postscript as an inline image?!?  Cool but not very useful.  To use this
# you'll need to make sure that ghostscript has pbmraw, pgmraw, and ppmraw
# compiled in.  What do you mean you don't have ghostscript?  Shame, shame.
#
mimg    .eps       |pstopxm pbmraw %s 2> /dev/null
mimg    .ps        |pstopxm pbmraw %s 2> /dev/null
gimg    .ps        |pstopxm pgmraw %s 2> /dev/null
gimg    .eps       |pstopxm pgmraw %s 2> /dev/null
cimg    .ps        |pstopxm ppmraw %s 2> /dev/null
cimg    .eps       |pstopxm ppmraw %s 2> /dev/null

# gopher bogusness
gopher ^/9      unknown
gopher ^/0      text
gopher ^/g      !xloadimage %s 2> /dev/null
gopher ^/h      html
gopher ^/I      !xloadimage %s 2> /dev/null
gopher ^/s      !if [ -w /dev/audio ]; then cat %s > /dev/audio; else echo Computer does not have a sound device or the sound device is unavailable; fi
gopher ^/5      unknown
gopher ^/4      unknown

#
# Deal with telnet.  Run the thing inside xterm and pass the data
# which describes the username, hostname, and port.
# Bogus?  You betcha!  But it gets me out of some work.
#
telnet *        !xterm -e dotelnet %s
tn3270 *        !xterm -e do3270 %s

# These types work for http and ftp
* .au		!if [ -w /dev/audio ]; then cat %s > /dev/audio; else echo Computer does not have a sound device or the sound device is unavailable; fi
* .mpg		!mpeg_play %s 1>&2 2> /dev/null
* .mpeg		!mpeg_play %s 1>&2 2> /dev/null
* .ps		!xterm -e gs %s
* .dvi		!xdvi %s 2> /dev/null
* .gif		!xview %s
* .jpg		!xview %s
* .jpeg		!xview %s
* .xbm		!xview %s
* .tiff		!xview %s
* .pbm		!xview %s
* .ppm		!xview %s
* .pgm		!xview %s
* .pnm		!xview %s
* .tar		unknown
* .z            unknown
* .taz          unknown
* .gz           unknown
* .tgz          unknown
* .zip          unknown
* .hqx          unknown
* .lha          unknown
* .lzh          unknown 
* .exe          unknown 
* .html		html
* .www		html
* .txt		text
* .tex		text
* ^README	text
* README	text
* ^INSTALL	text
* ^Makefile	text
* Makefile	text
* .list         text
* .lst          text
* .text         text

#
# Chimera will use the MIME Content-type if it is available and I've
# managed to implement Content-type grabbing for the access method.
#
# This section is anything but complete.
#

* ^text/html	html
* ^text/text    text
* ^text/plain   text
* ^text/x-dvi   !xdvi %s 2> /dev/null
* ^text/postscript !xterm -e gs %s 

* ^application/postscript !xterm -e gs %s
* ^application/x-dvi !xdvi %s 2> /dev/null

* ^image/x-xwindowdump !xwud -in %s 2> /dev/null
* ^image/x-xbitmap !xwud -in %s 2> /dev/null
* ^image/	!xview %s 2> /dev/null

* ^video/mpeg	!mpeg_play %s 1>&2 2> /dev/null

* ^audio/basic  !if [ -w /dev/audio ]; then cat %s > /dev/audio; else echo Computer does not have a sound device or the sound device is unavailable; fi

#
# Defaults for each access
#

http *          html
ftp  *          text
gopher *        text
file *          text
