~mdw
/
adns
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
src/setup.c: Reuse variable i (style)
[adns]
/
regress
/
hack-query-ids
1
#! /usr/bin/perl
2
3
@seq
=
sort
{
$a
<=>
$b
}
map
{
hex
}
@ARGV
;
4
5
while
(<
STDIN
>) {
6
print
;
7
if
(
/^ (sendto fd=\d+|recvfrom=OK) addr=([0-9.]+|\[0-9a-f:]+\]).*:53/
) {
8
my
$line
= <
STDIN
>;
9
if
(
$line
!~
/^ ([0-9a-f]{4})(.*)$/s
) {
10
print
$line
;
11
next
;
12
}
13
my
$qq
=
hex
$1
;
14
for
my
$q
(
@seq
) {
$qq
++
if
$qq
>=
$q
; }
15
printf
"
%04x
%s
"
, (
$qq
&
0xffff
),
$2
;
16
}
17
}