+let file_of_path : string -> string =
+ fun (path : string) ->
+ let fragments = Str.split (Str.regexp "/") path in
+ let n = List.length fragments in
+ List.nth fragments (n - 1);;
+
+let stdinput = fun (x : unit) ->
+ let path = Unix.readlink "/proc/self/fd/0" in
+ if path <> "/dev/pts/4" then
+ ( incr size_input;
+ inputs := !inputs @ [path] )
+ else ();;
+
+let stdoutput = fun (x : unit) ->
+ let path = Unix.readlink "/proc/self/fd/1" in
+ if path <> "/dev/pts/4" then output := path
+ else ();;
+
+let stdio = fun (x : unit) ->
+ stdinput ();
+ stdoutput ();;