From 03b6a364e7240ca827585e7baff225a0aaa33bc6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kim=20Nguy=E1=BB=85n?= Date: Thu, 4 Apr 2013 16:17:32 +0200 Subject: [PATCH] Fix the build script. --- build | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/build b/build index f381c94..75781b0 100755 --- a/build +++ b/build @@ -1,20 +1,17 @@ #!/usr/bin/env ocaml -let file_content = - let buffer = Buffer.create 128 in - begin fun f -> - Buffer.clear buffer; - try - let in_f = open_in f in - while true do - let line = input_line in_f in - Buffer.add_string buffer line; - Buffer.add_char buffer ' '; - done; - failwith "finished" - with - e -> let s = Buffer.contents buffer in s - end +let read_lines f = + let lines = ref [] in + let in_f = open_in f in + try + while true do + let line = input_line in_f in + if String.length line != 0 then lines := line :: !lines + done; + [] + with + End_of_file -> close_in in_f; List.rev !lines +;; let target = ref [ ] let debug = ref false @@ -47,7 +44,7 @@ let otarget = List.fold_left (fun acc t -> else let t = if Filename.check_suffix t ".otarget" then - file_content ((Filename.chop_suffix t ".otarget") ^ ".itarget") + String.concat " " (read_lines ((Filename.chop_suffix t ".otarget") ^ ".itarget")) else t in t ^ " " ^ acc) "" (if (!target == []) then [ "main.otarget" ] else !target) -- 2.17.1