49 |
let n = String.index s '\n' in |
let n = String.index s '\n' in |
50 |
let s1 = String.sub s 0 n in |
let s1 = String.sub s 0 n in |
51 |
let s2 = String.sub s n ((String.length s) - n) in |
let s2 = String.sub s n ((String.length s) - n) in |
52 |
Buffer.clear buf; |
Buffer.reset buf; |
53 |
Buffer.add_string buf s2; |
Buffer.add_string buf s2; |
54 |
match s1 with |
match s1 with |
55 |
"" -> raise End_of_file |
"" -> raise End_of_file |
56 |
| _ -> s1 |
| _ -> s1 |
57 |
with |
with |
58 |
Not_found -> |
Not_found -> |
59 |
Buffer.clear buf; |
Buffer.reset buf; |
60 |
s |
s |
61 |
|
|
62 |
let buf_input buf str pos len = |
let buf_input buf str pos len = |
63 |
let s = Buffer.contents buf in |
let s = Buffer.contents buf in |
64 |
Buffer.clear buf; |
Buffer.reset buf; |
65 |
let s1 = |
let s1 = |
66 |
try String.sub s 0 len |
try String.sub s 0 len |
67 |
with _ -> raise End_of_file |
with _ -> raise End_of_file |