+let dir = try Sys.getenv dir_env_var with Not_found -> default_dir in
+let errmsg =
+ sprintf
+"<html>
+ <head>
+ <title>Graph: error</title>
+ </head>
+ <body>
+ <h1>Error occured while drawing graph!<br />Please report the occured problem</h1>
+ <h2>%s</h2>
+ </body>
+</html>"
+in
+let string_of_exit_status = function
+ | Unix.WEXITED n -> sprintf "Process exited with code %d" n
+ | Unix.WSIGNALED n -> sprintf "Process killed by signal %d" n
+ | Unix.WSTOPPED n -> sprintf "Process stopped by signal %d" n
+in
+let callback (req: Http_types.request) outchan =