1 let i_a = int_of_char 'a'
2 let i_A = int_of_char 'A'
3 let i_f = int_of_char 'f'
4 let i_F = int_of_char 'F'
5 let i_0 = int_of_char '
0'
6 let i_9 = int_of_char '
9'
9 let i = int_of_char c
in
10 if i >= i_a && i <= i_f then i - i_a + 10 else
11 if i >= i_A && i <= i_F then i - i_A + 10 else
12 if i >= i_0 && i <= i_9 then i - i_0 else
13 failwith
"Bad hexa char"
16 let len = String.length s
in
18 lprintf
"%s" header
; lprint_newline
();
19 lprintf
"MESSAGE SIZE: %d" len; lprint_newline
();
21 for i = 0 to len - 1 do
23 let n = int_of_char
c in
24 if n > 31 && n < 127 then
31 for i = 0 to len - 1 do
33 let n = int_of_char
c in
40 let header = ref "" in
41 let buf = Buffer.create
1000 in
44 let rec iter pos line
len =
47 let v = digit_hexa line
.[pos
] in
48 let vv = digit_hexa line
.[pos
+1] in
49 let v = v * 16 + vv in
51 Buffer.add_char
buf (char_of_int
v)
55 with _ -> iter (pos
+1) line
len
58 let line = input_line stdin
in
59 let len = String.length
line in
60 if len > 2 && line.[0] = '
0'
&& line.[1] = 'x'
then
61 let pos = String.index
line '
\t'
in
62 let end_pos = String.rindex
line '
\t'
in
63 let len = end_pos - pos - 2 in
65 if !left > 100000 then begin
66 lprintf "DISCARD [%s]" line;
69 let line = String.sub
line (pos+2) len in
72 dump !header (Buffer.contents
buf);
79 lprintf
"Exception %s" (Printexc2.to_string e
);lprint_newline
();
80 dump !header (Buffer.contents
buf)