#!/bin/sh
#@(#)HP X Station Admin Scripts
#
# xtutil_get-os	
#
#   returns Operating System of current host as a string
#   possible return values are: 
#   "sun4", "sun5", "sco", "hp8", "hp", "hp10", "mips", "aix"
#

# default path
PATH="/sbin:/usr/sbin:/bin:/usr/bin:/etc:/usr/etc:/usr/local/bin:/usr/ucb:/usr/ccs"

# auto export all variables for simplicity
set -a	

if [ -x /bin/sun ]
then
  if /bin/sun
  then
    OS=sun4
    if [ `uname -r | cut -c1` = "5" ]
    then
      OS=sun5
    fi
  fi
else
  OS=`uname -m`
  if [ $OS = "i386" -o $OS = "i486" ]
  then
    OS=sco
  else
    case "`uname`" in
      HP-UX)
        case "`uname -r | awk -F'.' '{print $2}'`" in
	  08)
	    OS=hp8 ;;
	  09)
	    OS=hp ;;
	  1[01])
	    OS="hp10" ;;
	  *)
	    echo unknown OS: "`uname -a`" >&2
	    exit 1
	    ;;
        esac
	;;
      AIX)
        OS=aix 
	;;
      *)
        case "`uname -m`" in
	  mips)
	    OS=mips ;;
	  *)
	    echo unknown OS: "`uname -a`" >&2
	    exit 1
	    ;;
        esac
        ;;
    esac
  fi
fi

echo $OS
exit 0
