#!/bin/sh

# architecture,v 1.1 1995/02/28 19:48:09 pfkeb Exp
#
# Copyright (C)  1992  The Board of Trustees of The Leland Stanford
# Junior University.  All Rights Reserved.


# simple way of overriding all other tests
if test -n "$ARCH"; then
   echo $ARCH
   exit 0
fi

if test -n "${HOSTTYPE}"; then
   case "${HOSTTYPE}" in
      rs6000)
         echo aix6000 ;;
      decstation)
         echo ultrix ;;
      iris4d)
         echo sgi ;;
      hp9000s800)
         echo hpux ;;
      *)
         echo ${HOSTTYPE} ;;
   esac
   exit 0
fi

cat /etc/motd | grep ULTRIX >/dev/null
if test $? -eq 0; then
   echo ultrix
   exit 0
fi

cat /etc/motd | grep -i AIX >/dev/null
if test $? -eq 0; then
   echo aix6000
   exit 0
fi

cat /etc/motd | grep -i SunOS >/dev/null
if test $? -eq 0; then
   echo sun4
   exit 0
fi

/bin/4d > /dev/null 2> /dev/null
if test $? -eq 0; then
   echo sgi
   exit 0
fi

/bin/arch > /dev/null 2> /dev/null
if test $? -eq 0; then
   echo `/bin/arch`
   exit 0
fi

/bin/uname > /dev/null 2> /dev/null
if test $? -eq 0; then
   case "`/bin/uname`" in
      SunOS)
         echo sun4 ;;
      AIX)
         echo aix6000 ;;
      ULTRIX)
         echo ultrix ;;
      SGI)
         echo sgi ;;
      *)
         echo `/bin/uname` ;;
   esac
   exit 0
fi

# The Next is a pain
# no uname, no motd, arggh
hostinfo > /dev/null 2>/dev/null
if test $? -eq 0; then
   hostinfo |grep -i NeXT > /dev/null 2> /dev/null
   if test $? -eq 0; then
      echo next
      exit 0
   fi
fi

if test -d /NextLibrary; then
   echo next
   exit 0
fi

if test -f /usr/bin/dread; then
   echo next
   exit 0
fi

if test -f /etc/svc.conf; then
   echo ultrix
   exit 0
fi

exit 1


