Debian Codegraph @

test/blackbox-tests/test-cases/directory-targets/old-style/target.t/cat_dir.ml

raw
1 let dir = Sys.argv.(1)
2
3 let input_all t =
4 let buffer = Buffer.create 0 in
5 let rec loop () =
6 Buffer.add_channel buffer t 65536;
7 loop ()
8 in
9 try loop () with
10 | End_of_file -> Buffer.contents buffer
11
12 let () =
13 let files =
14 Sys.readdir dir |> Array.to_list |> ListLabels.sort ~cmp:String.compare
15 in
16 ListLabels.iter files ~f:(fun file ->
17 let inp = open_in (Filename.concat dir file) in
18 Printf.printf "%s:\n%s\n" file (input_all inp)
19 )