(************************************************************ get_links.ml Created : Tue Nov 26 00:39:00 2002 Last modified: Wed Nov 27 00:15:06 2002 Compile: ocamlopt.opt str.cmxa get_links.ml -o get_links # FTP Directory: sources/ocaml # ************************************************************) (** @author Takashi Masuyama *) let anchor_regexp = Str.regexp_case_fold " result in let data = read_input "" in let rec get_group count result = try let start_position = Str.search_forward anchor_regexp data count in if Str.string_match anchor_regexp data start_position then get_group (Str.match_end ()) ((Str.matched_group 1 data)::result) else assert false with Not_found -> result in get_group 0 [] let _ = let files = ref [] in let specs = [] in let help_head_string = "" in begin Arg.parse specs (fun x -> files := x::!files) help_head_string; List.iter (fun x -> let input = open_in x in begin List.iter print_endline (get_all_links input); close_in input; end) !files; end