#!OCAMLRUN OCAML
#load "unix.cma";;
let (//) = Filename.concat
let dirname = Filename.dirname Sys.argv.(0)
let dirname = if Filename.is_relative dirname && dirname <> Filename.current_dir_name then Sys.getcwd () // dirname else dirname
let env =
  Array.map (fun var ->
   let value = try Sys.getenv var with _ -> dirname in
   let value = if value = "." then Sys.getcwd () else value in
   Printf.sprintf "%s=%s" var value)
   [|"PAPARAZZI_SRC"; "PAPARAZZI_HOME"|]
let com = dirname // "sw/supervision/paparazzicenter";;
Sys.argv.(0) <- com;;
let env = Array.append env (Unix.environment ());;
Unix.execve com Sys.argv env
