#!/bin/sh 

miExt=none
UNAME=uname
if [ x$1 = x ] ;then
	OS=`uname`
else
	OS=$1
fi

case $OS in 
	SunOS)
	        OSversion=`$UNAME -r | awk -F. '{print $1}' 2>/dev/null`
	        [ $OSversion = 5 ] && 
	                miExt=sunos5
		;;
	AIX)
		OSversion=`$UNAME -v`
		[ $OSversion = 4 ] && 
			miExt=aix4
		;;
	OSF1)
		OSversion=`$UNAME -r | awk -F. '{print $1}' 2>/dev/null`
		[ $OSversion = V4 ] && 
			miExt=decunix4
		;;
	HP-UX)
		OSversion=`$UNAME -r | awk -F. '{print $2}' 2>/dev/null`
		miProc=`$UNAME -m | awk -F/ '{if ($2 <= 800) print "PA1.0"; 
			else print "PA2.0"}'`
		[ $OSversion = 09 ] && 
			miExt=hpux9
		[ $OSversion = 10 ] && {
			miExt=hpux10
			[ $miProc = PA1.0 ] && miExt=hpux9
			[ -f /bin/sysinfo ] && miExt=sppux5
			}
		[ $OSversion = 11 ] && {
			miExt=hpux11
			[ $miProc = PA1.0 ] && miExt=hpux9
			}
		;;
	IRIX)
		OSversion=`$UNAME -r  2>/dev/null`
		case $OSversion in
		5.2|5.3)
			miExt=irix5-32
			;;
		6.0*|6.1*)
			;;
		6.*)
			miExt=irix6-n32
			;;
		esac
		;;
	IRIX64)
		OSversion=`$UNAME -r | awk -F. '{print $1}' 2>/dev/null`
		miExt=irix6-n32
		;;
	 Linux)
		OSversion=`$UNAME -m 2>/dev/null`
		[ $OSversion = i586 -o $OSversion = i686 ] && {
			miExt=linux-x86
			}
		[ $OSversion = alpha ] && {
			miExt=linux-alpha
			}
		;;
esac

#if [ $miExt = none ] ;then
#	echo "Sorry, platform $OS $OSversion is not supported"
#	echo "... supported platforms are: ..."
#	echo "  IRIX5.2"
#	echo "  IRIX5.3"
#	echo "  IRIX6.2"
#	echo "  IRIX6.3"
#	echo "  IRIX64 6.2"
#	echo "  IRIX64 6.3"
#	echo "  IRIX64 6.4"
# 	echo "  IRIX 6.5"
#	echo "  AIX4.x"
#	echo "  HP-UX9.x"
#	echo "  HP-UX11.x"
#	echo "  SPPUX5.x"
#	echo "  SunOS5.x"
#	echo "  OSF1 V4.x"
#	echo "  Linux x86"
#	echo "  Linux Alpha"
#	exit
#fi

echo $miExt
