7 if ($n =~ /^0/) { $n = oct $n; }
14 for (my $i = 0; $i < length $d; $i++) { $a ^= ord substr $d, $i, 1; }
15 return pack("S< C", 2 + length $d, $flag) . $d . chr($a);
18 @ARGV == 4 or die "usage: $0 TY NAME P1 P2";
19 my ($ty, $name, $p1, $p2) = @ARGV;
23 sysread STDIN, my $buf, 4096;
24 last READ unless length $buf;
29 $tap .= frame 0, pack "C A10 S< S< S<",
30 $ty, $name, length $body, intify $p1, intify $p2;
31 $tap .= frame 255, $body;
33 syswrite STDOUT, $tap;