#!/bin/sh
# $Id: test-application,v 1.2 2004/03/04 22:22:41 rbasch Exp $

. /mit/mimeutils/share/scripts/utils.sh

name=
subtype=

usage() {
  echo "Usage: test-application [-s subtype] [-t content-type]" 1>&2
  exit 1
}

while getopts s:t: opt; do
  case "$opt" in
    s)
      subtype=`echo $OPTARG | tr 'A-Z' 'a-z'`
      ;;
    t)
      subtype=`echo $OPTARG | awk -F/ '{ print $2; }' | tr 'A-Z' 'a-z'`
      ;;
    \?)
      usage
      ;;
  esac
done
shift `expr "$OPTIND" - 1`

case "$subtype" in
  mac-binhex40)
    # Currently no test for binhex40.
    exit 0
    ;;

  msword|x-msword)
    # Currently no test for msword.
    exit 0
    ;;

  excel|x-excel)
    exec test-xdisplay
    ;;

  postscript)
    exec test-xdisplay
    ;;

  pdf)
    exec test-xdisplay
    ;;

  x-dvi)
    exec test-xdisplay
    ;;

  x-ez)
    # Currently no test for ez.
    exit 0
    ;;

  x-framemaker)
    exec test-framemaker
    ;;

  octet-stream|octet-string)
    # Currently no test for octet-stream
    # (octet-string is stupid AOL brokenness)
    exit 0
    ;;

esac

maybe_becho "Unknown content type application/$subtype"
exit 1
