X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fgetter%2Fhttp_getter_misc.mli;h=e9b013ebd496738596e7d3afbbe46f0877b0164b;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=5daac8c32eda068248210d5802bede58ba331bd7;hpb=73ad0985990447db97f17870d2744f8fda13ebe4;p=helm.git diff --git a/helm/ocaml/getter/http_getter_misc.mli b/helm/ocaml/getter/http_getter_misc.mli index 5daac8c32..e9b013ebd 100644 --- a/helm/ocaml/getter/http_getter_misc.mli +++ b/helm/ocaml/getter/http_getter_misc.mli @@ -30,22 +30,32 @@ failure reason *) exception Mkdir_failure of string * string - (** true for URI belonging to the "file://" scheme *) -val is_local_url: string -> bool + (** @return Some localpart for URI belonging to the "file://" scheme, None for + * other URIs + * removes trailing ".gz", if any + * e.g.: local_url "file:///etc/passwd.gz" = Some "/etc/passwd" + * local_url "http://...." = None *) +val local_url: string -> string option (** "fold_left" like function on file lines, trailing newline is not passed to the given function *) val fold_file : (string -> 'a -> 'a) -> 'a -> string -> 'a + (* "iter" like function on file lines, trailing newline is not passed to the given function *) val iter_file : (string -> unit) -> string -> unit + (* "iter" like function on file data chunks of fixed size *) +val iter_file_data: (string -> unit) -> string -> unit + (** like Hashtbl.fold but keys are processed ordered *) val hashtbl_sorted_fold : ('a -> 'b -> 'c -> 'c) -> ('a, 'b) Hashtbl.t -> 'c -> 'c (** like Hashtbl.iter but keys are processed ordered *) val hashtbl_sorted_iter : ('a -> 'b -> unit) -> ('a, 'b) Hashtbl.t -> unit +val list_uniq: 'a list -> 'a list (* uniq unix filter on lists *) + (** cp frontend *) val cp: string -> string -> unit (** wget frontend, if output is given it is the destination file, otherwise @@ -64,8 +74,9 @@ val gunzip: ?keep: bool -> ?output: string -> string -> unit suffix is used (actually "_http_getter" *) val tempfile: unit -> string (** mkdir frontend, if parents = true also parent directories will be created. - If the given directory already exists doesn't act *) -val mkdir: ?parents: bool -> string -> unit + If the given directory already exists doesn't act. + parents defaults to false *) +val mkdir: ?parents:bool -> string -> unit (** pretty printer for Unix.process_status values *) val string_of_proc_status : Unix.process_status -> string @@ -78,3 +89,14 @@ val http_get: string -> string option (** true on blanks-only and #-commented lines, false otherwise *) val is_blank_line: string -> bool +val normalize_dir: string -> string (** add trailing "/" if missing *) +val strip_trailing_slash: string -> string +val strip_suffix: suffix:string -> string -> string + +val extension: string -> string (** @return string part after rightmost "." *) + +val temp_file_of_uri: string -> string * out_channel + + (** execute a command and return first line of what it prints on stdout *) +val backtick: string -> string +