From: Stefano Zacchiroli Date: Wed, 8 Jan 2003 14:26:46 +0000 (+0000) Subject: - added debugging log messages in g{,un}zip X-Git-Tag: v0_3_99~66 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=b3bd459aeedce3ae8b21e25c3f8cab730bd544f9;p=helm.git - added debugging log messages in g{,un}zip --- diff --git a/helm/http_getter/http_getter_misc.ml b/helm/http_getter/http_getter_misc.ml index 0790d9415..0bc701685 100644 --- a/helm/http_getter/http_getter_misc.ml +++ b/helm/http_getter/http_getter_misc.ml @@ -77,8 +77,11 @@ let wget ?output url = end else (* other URL, pass it to wget *) use_wget () -let bufsiz = 16384 +let bufsiz = 16384 (* for g{,un}zip *) +let trailing_dot_gz_RE = Pcre.regexp "\\.gz$" (* for g{,un}zip *) + let gzip ?(keep = false) fname = + debug_print (sprintf "gzipping %s (keep: %b)" fname keep); let (ic, oc) = (open_in fname, Gzip.open_out (fname ^ ".gz")) in let buf = String.create bufsiz in (try @@ -91,8 +94,8 @@ let gzip ?(keep = false) fname = Gzip.close_out oc; if not keep then Sys.remove fname -let trailing_dot_gz_RE = Pcre.regexp "\\.gz$" let gunzip ?(keep = false) fname = + debug_print (sprintf "gunzipping %s (keep: %b)" fname keep); let basename = Pcre.replace ~rex:trailing_dot_gz_RE fname in assert (basename <> fname); let (ic, oc) = (Gzip.open_in fname, open_out basename) in