chiark / gitweb /
Portability: Fix assumption about read() and write() on connecting sockets
[adns] / regress / update-extra-select
1 #!/usr/bin/perl -wp
2 use strict;
3
4 our ($fd, $timeadj);
5
6 BEGIN {
7     $fd = -1;
8 }
9
10 if (m/^ connect fd=(\d+) /) {
11     $fd=$1; next;
12 }
13
14 if (m/^ read fd=$fd buflen=1$/) {
15     die if $timeadj;
16     print
17         " select max=".($fd+1)." rfds=null wfds=[$fd]".
18         " efds=null to=0.000000\n".
19         " select=1 rfds=null wfds=[$fd] efds=null\n".
20         "+0.000001\n";
21     $timeadj = -0.000001;
22 }
23
24 if (m/^ \+([0-9.]+)$/ && $timeadj) {
25     $_ = sprintf " +%.6f\n", $1 + $timeadj;
26     $timeadj = 0;
27 }