if n >= width then str
else (* if n < width then *) str ^ String.make (width-n) ' '
+(* Truncate an OCaml string at the first ASCII NUL character, ie. as
+ * if it were a C string.
+ *)
+let truncate_c_string str =
+ try
+ let i = String.index str '\000' in
+ String.sub str 0 i
+ with
+ Not_found -> str
+
(** General binary tree type. Data 'a is stored in the leaves and 'b
is stored in the nodes. *)
type ('a,'b) binary_tree =