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).
3 * $Id: ocaml_version.ml,v 1.1 2006-10-31 14:39:50 rich Exp $
6 let usage () = failwith "ocaml_version major|minor"
8 if Array.length Sys.argv < 2 then
10 else match Sys.argv.(1) with
14 let ocaml_version = Sys.ocaml_version
15 let i = String.index ocaml_version '.'
18 | Major -> String.sub ocaml_version 0 i
21 try String.index_from ocaml_version (i+1) '.'
22 with Not_found -> String.length ocaml_version in
23 String.sub ocaml_version (i+1) (j-i-1)
24 let s = string_of_int (int_of_string s) ;;