#!/bin/sh
#
# uname
#
# Author: Jim Vlcek, ByteWare Consulting (uunet!molly!vlcek) 3 Dec 1993
# Tweaked-By: Larry Blische (lkba!lkb@uunet.uu.net)
# Warped-By: Tom Hageman (tom@basil.icce.rug.nl) 8 Dec 1993
#
# An attempt to implement a SysV-ish "uname" under NeXTStep 3.x
#
# Options
#
# -s    Print the operating system name
# -n    Print the node name (essentially, the hostname)
# -v    Print the operating system version
# -r    Print the operating system release
# -p    Print the host machine's processor type
# -m    Print the machine hardware name
# -a    Print all the above information
#
# Non-SysV options
#
# -i    Print the host identification number (hostid)
#

case "$*" in
 "")    set - -s ;;
 *-a*)  set - -s -n -v -r -p -m ;;
esac

for arg
do
  case $arg in
   -s)  system="NEXTSTEP" ;;
   -n)  node="`uuname -l`" ;;
   -r)  release="`hostinfo | sed -n 's/.*NeXT Mach \([0-9\.]*\).*/\1/p'`" ;;
   -m)  mach="`hostinfo | sed -n 's/.*Processor type: \([^ ]*\).*/\1/p'`" ;;
   -p)  processor="`hostinfo | \
                   sed -n 's/.*Processor type: [^ ]* (\([^)]*\).*/\1/p'`" ;;
   -v)  version="`tail -1 /usr/lib/NextStep/software_version`" ;;
   -i)  hostid="`hostid`" ;;
   *)   echo $0: Usage: $0 [-asnvrpmi] >&2 ; exit 1 ;;
  esac
done

echo $system $node $version $release $processor $mach $hostid
