Merge pull request #5 from rmdir/master

DragonFly and OpenIndiana portability
This commit is contained in:
nojhan 2012-07-24 01:08:46 -07:00
commit 782df4845c

View File

@ -67,6 +67,8 @@ OS="Linux"
case $(uname) in
"Linux" ) OS="Linux" ;;
"FreeBSD") OS="FreeBSD" ;;
"DragonFly") OS="FreeBSD" ;;
"SunOS") OS="SunOS" ;;
esac
# Colors declarations
@ -133,16 +135,21 @@ else
fi
# get cpu number
__cpunum_Linux ()
__cpunum_Linux()
{
grep ^processor /proc/cpuinfo | wc -l
}
__cpunum_FreeBSD ()
__cpunum_FreeBSD()
{
sysctl -n hw.ncpu
}
__cpunum_SunOS()
{
kstat -m cpu_info | grep "module: cpu_info" | wc -l
}
__CPUNUM=$(__cpunum_$OS)
@ -160,6 +167,12 @@ __load_FreeBSD()
echo -n "$load"
}
__load_SunOS()
{
load=$(LANG=C uptime | awk '{print $10}'| sed -e 's/,//')
echo -n "$load"
}
###############
# Who are we? #