#!/bin/sh
#
# @(#) $Id: mdtype,v 1.3 1996/08/06 12:16:45 moj Exp $
#
# Determine machine type.
#
machine="UNKNOWN"

if [ -f /usr/bin/uname ]; then

    os=`/usr/bin/uname`
	
    if [ $os = "AIX" ]; then
	if [ "`/usr/bin/uname -v`" = "3" ]; then
	    machine="rs6000"
	fi
	if [ "`/usr/bin/uname -v`" = "4" ]; then
	    hw="`/usr/sbin/lsattr -l proc0 -E -a type | /usr/bin/cut -d\   -f2`"
	    if [ $hw = "PowerPC_601" ]; then
		machine="rs6000"
	    fi 
	    if [ $hw = "POWER" ]; then
		machine="rs6000"
	    fi 
	    if [ $hw = "POWER2" ]; then
		machine="rs6000"
	    fi 
	fi
    fi

    if [ $os = "SunOS" ]; then
	machine="`/usr/bin/uname -m |/usr/bin/cut -c1-4 `"
    fi

    if [ $os = "NetBSD" ]; then
	machine="`/usr/bin/uname -m`"
    fi

    if [ $machine = "sparc" ]; then
	machine="sun4"
    fi

fi

echo $machine

if [ $machine = "UNKNOWN" ]; then
    exit 1
else
    exit 0
fi
