From: Stefano Zacchiroli Date: Fri, 4 Feb 2005 09:24:46 +0000 (+0000) Subject: local_url predicate (recognize file:// urls) X-Git-Tag: V_0_1_0~33 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=73ad0985990447db97f17870d2744f8fda13ebe4;p=helm.git local_url predicate (recognize file:// urls) --- diff --git a/helm/ocaml/getter/http_getter_misc.ml b/helm/ocaml/getter/http_getter_misc.ml index eeea89160..c6a5954e5 100644 --- a/helm/ocaml/getter/http_getter_misc.ml +++ b/helm/ocaml/getter/http_getter_misc.ml @@ -35,6 +35,8 @@ let file_scheme_RE = Pcre.regexp ~flags:[`CASELESS] "^file://" let dir_sep_RE = Pcre.regexp "/" let heading_slash_RE = Pcre.regexp "^/" +let is_local_url s = Pcre.pmatch ~rex:file_scheme_RE s + let bufsiz = 16384 (* for file system I/O *) let tcp_bufsiz = 4096 (* for TCP I/O *) diff --git a/helm/ocaml/getter/http_getter_misc.mli b/helm/ocaml/getter/http_getter_misc.mli index 11bba25c5..5daac8c32 100644 --- a/helm/ocaml/getter/http_getter_misc.mli +++ b/helm/ocaml/getter/http_getter_misc.mli @@ -30,6 +30,9 @@ failure reason *) exception Mkdir_failure of string * string + (** true for URI belonging to the "file://" scheme *) +val is_local_url: string -> bool + (** "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