#!/bin/sh -e
# -*- sh -*-

# This file Copyright (c) 1994 Z-Code Software, a Division of NCD.
# Permission to use, copy, modify, and distribute this material
# for any purpose and without fee is hereby granted, provided
# that the above copyright notice and this permission notice
# appear in all copies, and that the name of Z-Code Software not
# be used in advertising or publicity pertaining to this
# material without the specific, prior written permission
# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.


if [ $# -ge 1 ]; then
  
  magictype=`file "$1" | sed 's/[^:]*:[ 	]*//'`
  
  cat << end-of-mappings |
\
application/postscript		[Pp]ost[Ss]cript
application/x-framemaker	Frame Maker
application/x-inventor		Inventor
application/x-showcase		Showcase
application/x-wingz		Wingz
application/x-zm-folder		mail folder
audio/basic			8-bit u-law, mono, 8000 Hz
audio/x-aiff			AIFF sound
image/gif			GIF image
image/pbm			PBM
image/x-sgi-image		SGI imagelib image
text/plain			English text
text/plain			ascii text
text/plain			commands text
text/plain			script
text/plain			c program text
video/x-sgi-movie		Silicon Graphics movie
\
end-of-mappings

  while read mime text; do
    case "$magictype" in
      *$text* ) echo $mime; exit 0 ;;
    esac
  done

else

  echo "Usage: $0 <file-name>"
  exit 1

fi
