# Copyright (C) 2006-2009, Parrot Foundation. # $Id$ .macro_const BUFLEN 256 .sub 'main' :main .local pmc fh, striter fh = new ['FileHandle'] fh.'encoding'('binary') fh.'open'('/dev/urandom', 'r') $S0 = fh.'read'(.BUFLEN) $P0 = box $S0 striter = iter $P0 $I1 = 1 loop: unless striter goto endloop $I0 = shift striter 'printf'('%2x ', $I0) $I2 = $I1 % 8 inc $I1 if $I2 goto loop print "\n" goto loop endloop: .end .sub 'printf' .param string fmt .param pmc args :slurpy $S0 = sprintf fmt, args print $S0 .end # Local Variables: # mode: pir # fill-column: 100 # End: # vim: expandtab shiftwidth=4 ft=pir: