# # patch "ChangeLog" # from [52083fb3bf800ba1b5a5028400475cd1499c7810] # to [c24be5c02302184563fc393c0e804d763c50579e] # # patch "contrib/get_stdio.pl" # from [6bf6efac0e90644da8338ee03e289a6d0f184278] # to [5c3e8481d0ccb6f99bf77f17bc10b1bdcd048d01] # ======================================================================== --- ChangeLog 52083fb3bf800ba1b5a5028400475cd1499c7810 +++ ChangeLog c24be5c02302184563fc393c0e804d763c50579e @@ -1,3 +1,8 @@ +2005-10-10 Timothy Brownawell + + * contrib/get_stdio.pl: Add comments. I'm told it was "obtuse", + hopefully this will help somewhat. + 2005-10-08 Matthew Gregan * tests/t_automate_keys.at: Portability fixes. ======================================================================== --- contrib/get_stdio.pl 6bf6efac0e90644da8338ee03e289a6d0f184278 +++ contrib/get_stdio.pl 5c3e8481d0ccb6f99bf77f17bc10b1bdcd048d01 @@ -11,17 +11,28 @@ { $x = $x . $_; } + +# packet is cmdnum:errcode:(last|more):size:contents +# note that contents may contain newlines (or may even be binary) +# this does: + +# for i in split_into_packets($x) +# $results[i.cmdnum] += i.contents +# +# print $results[n] + +# read a packet from $x (the contents of the file) while($x =~ /(\d+)\:\d+\:[lm]\:(\d+)\:/s) -{ +{# $1, $2, etc (what was matched by the parentheses) are dynamically scoped $m=int($2); my $n=""; - $x = $';#' - for(;$m > 0; $m--) + $x = $'; #' # what's left after the end of the match + for(;$m > 0; $m--) # read $m bytes, leaving $x as what's left { $x =~ /(.)/s; $n = $n . $1; - $x = $';#' + $x = $'; #' # gedit syntax coloring gets messed up on $' . } - $results[$1] = $results[$1] . $n; + $results[$1] = $results[$1] . $n; # the $1 from the while } print $results[$ARGV[1]];