1 (* Get the major or minor part of the OCaml version string.
2 * This doesn't seem t be present in header files (at least not in 3.08.x).
5 let usage () = failwith "ocaml_version major|minor"
7 if Array.length Sys.argv < 2 then
9 else match Sys.argv.(1) with
13 let ocaml_version = Sys.ocaml_version
14 let i = String.index ocaml_version '.'
17 | Major -> String.sub ocaml_version 0 i
20 try String.index_from ocaml_version (i+1) '.'
21 with Not_found -> String.length ocaml_version in
22 String.sub ocaml_version (i+1) (j-i-1)
23 let s = string_of_int (int_of_string s) ;;