August 17, 2019, 09:03:06 pm

fixed uname -r

Started by roytam1, April 01, 2012, 04:20:24 am

Previous topic - Next topic

roytam1

The uname from http://www.nextcomputers.org/NeXTfiles/Software/NEXTSTEP/Developer/uname.gz has `uname -r` broken which returns nothing.
The attached version fixes this issue.

#!/bin/sh
#
# uname
#
# Author: Jim Vlcek, ByteWare Consulting (uunet!molly!vlcek) 3 Dec 1993
#
# An attempt to implement a SysV-ish "uname" under NeXTStep 3.0
#
# 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)
#

if [ $# = 0 ]
then
       system="NEXTSTEP "
fi

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` " ;;
               -a)     exec $0 -s -n -v -r -p -m ;;
               *)      echo $0: Usage: $0 [-asnvrpm] >&2 ; exit 1 ;;
       esac
done

echo "$system""$node""$version""$release""$processor""$mach" | sed -e 's/ $//'


eagle

Thank you for posting this. I have a script that uses uname, and I was glad to find this on the forums!
My NeXTs:
NeXT Computer prototype (68030-25 x2, 68040-25)
Two NeXTstations (68040-25)
All mono