Changeset 540


Ignore:
Timestamp:
Jan 16, 2019, 11:49:03 PM (6 years ago)
Author:
katerina
Message:

Missing fix for ticket #431 (OpenBSD compatibility)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/c_random.sh

    r1 r540  
    1616  if test -c "/dev/urandom"; then
    1717    dd if=/dev/urandom ibs=1 count=4 > my_random_file 2>/dev/null
    18     nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
     18    nsum=`cksum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
    1919    if test x$nsum != x; then
    2020      rnd_tst=yes
     
    2727      if test -c "/dev/srandom"; then
    2828        dd if=/dev/srandom ibs=1 count=4 > my_random_file 2>/dev/null
    29         nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
     29        nsum=`cksum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
    3030       if test x$nsum != x; then
    3131          rnd_tst=yes
     
    218218    fi
    219219#
    220     nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
     220    nsum=`cksum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
    221221#
    222222fi
    223223
    224224#
    225 # 'sum' is portable, but only 16 bit
     225# 'cksum' is more portable than 'sum', but 32 bit
    226226#
    227227
    228228/bin/rm -f ./my_random_file 2>/dev/null
    229229
    230 echo $nsum
    231 
    232 
     230final=`expr $nsum \% 65536`
     231echo $final
     232
     233
Note: See TracChangeset for help on using the changeset viewer.