#!/bin/sh 
# 
#	  Name: platform 
#		write the platform of various UN*Xs to standard out 
#	Author: Rick Troth, Houston, Texas, USA 
#	  Date: various 
# 
 
# 
# first, just try 'uname': 
UNAME="unix" 
if [ -x /bin/uname ]; then UNAME=`/bin/uname`; fi 
if [ "$UNAME" = "SunOS" -a -x /bin/arch ]; then exec /bin/arch; fi 
 
# 
# now, for most cases, 'uname' output will suffice: 
if   [  "$UNAME" = "AIX" -o \
	"$UNAME" = "IRIX" -o \
	"$UNAME" = "Linux" -o \
	"$UNAME" = "SunOS" -o \
	"$UNAME" = "HP-UX" ]; then echo "$UNAME"; exit; fi 
 
# 
# fallback to old methods ... is there an "arch" command? 
if [ -f /bin/arch ];                then exec /bin/arch; fi 
if [ -f /usr/bin/arch ];	    then exec /usr/bin/arch; fi 
if [ -f /usr/local/bin/arch ];	    then exec /usr/local/bin/arch; fi 
 
# 
# then, is there a system or local "platform" command? 
if [ -f /bin/platform ];            then exec /bin/platform; fi 
if [ -f /usr/bin/platform ];	    then exec /usr/bin/platform; fi 
if [ -f /usr/local/bin/platform ];  then exec /usr/local/bin/platform; fi 
 
# 
# third, what about certain unique directories? 
if [ -d /usr/lpp ];		    then echo "rs6000";     exit; fi 
# or maybe unique files or programs? 
if [ -f /usr/bin/X11/4Dwm ];        then echo "sgi";        exit; fi 
 
# 
# if all else fails ... 
if [ -f /bin/uname ];               then exec /bin/uname; fi 
 
# 
# if somehow there's no /bin/uname, then ... 
echo "unix" 
 

