open Arg let default_procfs_dir = "/Process" let default_uptime_path = ref (String.concat "" (List.append [default_procfs_dir] ["/uptime"])) let set_uptime_path dir = default_uptime_path := (String.concat "" (List.append [dir] ["/uptime"])) let read_data filename = let ic = open_in filename in try let line = input_line ic in close_in ic; (line) with e -> close_in_noerr ic; raise e let main = begin (* Printf.printf "%s\n" !default_uptime_path; *) let speclist = [ ("-p",Arg.String (set_uptime_path),"Procfs directory") ] in let usage_msg = "ouptime - show system uptime" in Arg.parse speclist print_endline usage_msg; Printf.printf "%s\n" !default_uptime_path; let uptime_string = read_data !default_uptime_path in print_endline uptime_string; end let () = main