summaryrefslogtreecommitdiffstats
path: root/sysprep/utils.ml
diff options
context:
space:
mode:
Diffstat (limited to 'sysprep/utils.ml')
-rw-r--r--sysprep/utils.ml16
1 files changed, 16 insertions, 0 deletions
diff --git a/sysprep/utils.ml b/sysprep/utils.ml
index 3b3ad8af..81877249 100644
--- a/sysprep/utils.ml
+++ b/sysprep/utils.ml
@@ -86,3 +86,19 @@ let skip_dashes str =
let compare_command_line_args a b =
compare (String.lowercase (skip_dashes a)) (String.lowercase (skip_dashes b))
+
+let read_whole_file path =
+ let buf = Buffer.create 16384 in
+ let chan = open_in path in
+ let maxlen = 16384 in
+ let s = String.create maxlen in
+ let rec loop () =
+ let r = input chan s 0 maxlen in
+ if r > 0 then (
+ Buffer.add_substring buf s 0 r;
+ loop ()
+ )
+ in
+ loop ();
+ close_in chan;
+ Buffer.contents buf