summaryrefslogtreecommitdiffstats
path: root/c_random.sh
diff options
context:
space:
mode:
Diffstat (limited to 'c_random.sh')
-rwxr-xr-xc_random.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/c_random.sh b/c_random.sh
index cc863aa..a51466e 100755
--- a/c_random.sh
+++ b/c_random.sh
@@ -15,7 +15,7 @@ rnd_tst=no
if test -r "/dev/urandom"; then
if test -c "/dev/urandom"; then
dd if=/dev/urandom ibs=1 count=4 > my_random_file 2>/dev/null
- nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
+ nsum=`cksum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
if test x$nsum != x; then
rnd_tst=yes
fi
@@ -26,7 +26,7 @@ if test x$rnd_tst = xno; then
if test -r "/dev/srandom"; then
if test -c "/dev/srandom"; then
dd if=/dev/srandom ibs=1 count=4 > my_random_file 2>/dev/null
- nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
+ nsum=`cksum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
if test x$nsum != x; then
rnd_tst=yes
fi
@@ -217,16 +217,17 @@ if test x$rnd_tst = xno; then
/usr/local/bin/procinfo -a >> my_random_file 2>/dev/null
fi
#
- nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
+ nsum=`cksum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
#
fi
#
-# 'sum' is portable, but only 16 bit
+# 'cksum' is more portable than 'sum', but 32 bit
#
/bin/rm -f ./my_random_file 2>/dev/null
-echo $nsum
+final=`expr $nsum \% 65536`
+echo $final