1- open Base
2- open Stdio
1+ open Printf
32
43let find_number ~pos str =
54 let len = String. length str in
@@ -20,7 +19,7 @@ let find_number ~pos str =
2019 | _ -> [] , pos
2120 in
2221 let number_lst, next = loop ~pos in
23- String. concat number_lst, next
22+ String. concat " " number_lst, next
2423
2524let () =
2625 let module C = Configurator. V1 in
@@ -30,26 +29,26 @@ let () =
3029 try Unix. open_process_in cmd
3130 with exc -> eprintf " could not open pg_config, cmd: '%s'" cmd; raise exc
3231 in
33- Exn. protectx ic ~finally: In_channel. close ~f: (fun ic ->
34- let pgsql_includedir = " -I" ^ In_channel. input_line_exn ic in
35- let pgsql_libdir = " -L" ^ In_channel. input_line_exn ic in
32+ Fun. protect ~finally: (fun () -> close_in ic) ( fun () ->
33+ let pgsql_includedir = " -I" ^ input_line ic in
34+ let pgsql_libdir = " -L" ^ input_line ic in
3635 let major, minor =
37- let line = In_channel. input_line_exn ic in
36+ let line = input_line ic in
3837 let print_fail () =
3938 eprintf " Unable to find versions from line '%s', cmd: '%s'" line cmd
4039 in
41- let exit_fail () = print_fail () ; Caml. exit 1 in
40+ let exit_fail () = print_fail () ; exit 1 in
4241 try
43- let first_space = String. index_exn line ' ' in
42+ let first_space = String. index line ' ' in
4443 let major, next = find_number ~pos: first_space line in
4544 let minor =
4645 (* Can also handle release candidates *)
4746 let c = line.[next] in
48- if Char. ( c = '.' ) then fst (find_number ~pos: next line)
49- else if Char. ( c <> 'r' || line.[next + 1 ] <> 'c' ) then exit_fail ()
47+ if c = '.' then fst (find_number ~pos: next line)
48+ else if c <> 'r' || line.[next + 1 ] <> 'c' then exit_fail ()
5049 else " 0"
5150 in
52- if String. ( major = " " || minor = " " ) then exit_fail ()
51+ if major = " " || minor = " " then exit_fail ()
5352 else
5453 " -DPG_OCAML_MAJOR_VERSION=" ^ major,
5554 " -DPG_OCAML_MINOR_VERSION=" ^ minor
0 commit comments