open Nock_lib let read_bytes path = let ic = open_in_bin path in let len = in_channel_length ic in let data = really_input_string ic len in close_in ic; Bytes.of_string data let describe_root noun = match noun with | Noun.Cell (tag, _) -> begin match tag with | Noun.Atom z -> Printf.printf "tag=%s\n" (Z.to_string z) | _ -> Printf.printf "tag=cell\n" end | Noun.Atom _ -> Printf.printf "atom pill\n" let () = if Array.length Sys.argv < 2 then begin prerr_endline "usage: process_pill path"; exit 1 end; let path = Sys.argv.(1) in let bytes = read_bytes path in let noun = Serial.cue bytes in describe_root noun