#!/bin/sh
#
# Copyright (c) 1992-1993 Michael A. Cooper.
# This software may be freely distributed provided it is not sold for 
# profit and the author is credited appropriately.
#
# $Header: /src/common/usc/bin/sysinfo/RCS/ostype,v 1.2 1993/09/20 21:29:54 mcooper Exp $
#
# Determine type of OS
#

#
# Find uname program.
#
if [ -f /usr/bin/uname ]; then
	unameprog=/usr/bin/uname
fi

#
# Determine our OS name if we can.
#
if [ "${unameprog}" ]; then
	osname="`${unameprog} -s`"
fi

#
# Try stupid file checks
#
if [ -z "${osname}" ]; then
	if [ -d /NextApps ]; then
		if [ -f /mach_kernel ]; then
			osname="nextstep3"
		else
			osname="nextstep2"
		fi
	elif [ -d /usr/alliant ]; then
		osname="concentrix"
	else
		echo "Unable to determine your OS type.";
		exit 1;
	fi
fi

osname="`echo ${osname} | tr '[A-Z]' '[a-z]'`"

#
# Get OS Version
#
case "${osname}" in
sunos|ultrix)
	if [ -z "${unameprog}" ]; then
		echo "No uname program found."
		exit 1
	fi
	osver="`${unameprog} -r`"
	;;
aix)
	osver="`${unameprog} -v`"
	;;
concentrix|nextstep)
	# We don't care what the os version is
	osver=""
	;;
esac

echo "${osname}${osver}"
