#!/bin/sh

###############################################################################
#									      #
#         UNIX Interactive Tools 4.3.1  per file type action script	      #
#			        Local version				      #
#	    Copyright (c) 1993, 1994 Tudor Hulubei & Andrei Pitis	      #
#									      #
###############################################################################

#
# This script executes a different action for each file type specified.
# The script tries to match (using uitmatch) the second parameter against
# the patterns given as command line arguments to uitmatch (see below).
# uitmatch returns 0 if the parameter doesn't match or the number in the
# list of the pattern that matched.
# If you want to add new file types & actions to this script, just add a
# new pattern after the last pattern in the list and a corresponding
# action to the 'case' statement.
#
# For grater flexibility, .uitaction's first parameter is the name of the
# directory where the file resides. So, you can get the complete file
# name appending the file base name to the file path just like that: $1/$2
#

if [ "$#" -ne 2 -o ! -d "$1" -o ! -f "$2" ]
then
    echo $0: UIT internal script >&2
    exit 255
fi

uitmatch $2 "*.foo" "*.bar"

type=$?

case $type in
1)	more $2;;					# *.foo
2)	more $2;;					# *.bar
esac

if [ $type != 0 ]
then
    echo
    echo "Press any key ..."
fi

exit $type
