Previous: , Up: Filters   [Contents][Index]


7.6.4 pk-strings

Below you can find a very simple Poke program that works like the standard Unix utility strings.

#!/usr/local/bin/poke -L
!#

/* Printable ASCII characters: 0x20..0x7e */

var stdin = open ("<stdin>");
var stdout = open ("<stdout>");

var offset = 0#B;

try
{
  flush (stdin, offset);

  var b = byte @ stdin : offset;
  if (b >= 0x20 && b <= 0x7e)
    byte  stdout : iosize (stdout) = b;

  offset = offset + 1#B;
}
until E_eof;

close (stdin);
close (stdout);