From 73ad0985990447db97f17870d2744f8fda13ebe4 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Fri, 4 Feb 2005 09:24:46 +0000 Subject: [PATCH] local_url predicate (recognize file:// urls) --- helm/ocaml/getter/http_getter_misc.ml | 2 ++ helm/ocaml/getter/http_getter_misc.mli | 3 +++ 2 files changed, 5 insertions(+) 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 -- 2.39.2