Portability: Fix assumption about read() and write() on connecting sockets
[adns] / regress / update-extra-select
diff --git a/regress/update-extra-select b/regress/update-extra-select
new file mode 100755 (executable)
index 0000000..0325309
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -wp
+use strict;
+
+our ($fd, $timeadj);
+
+BEGIN {
+    $fd = -1;
+}
+
+if (m/^ connect fd=(\d+) /) {
+    $fd=$1; next;
+}
+
+if (m/^ read fd=$fd buflen=1$/) {
+    die if $timeadj;
+    print
+       " select max=".($fd+1)." rfds=null wfds=[$fd]".
+       " efds=null to=0.000000\n".
+       " select=1 rfds=null wfds=[$fd] efds=null\n".
+       "+0.000001\n";
+    $timeadj = -0.000001;
+}
+
+if (m/^ \+([0-9.]+)$/ && $timeadj) {
+    $_ = sprintf " +%.6f\n", $1 + $timeadj;
+    $timeadj = 0;
+}