From b3bd459aeedce3ae8b21e25c3f8cab730bd544f9 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Wed, 8 Jan 2003 14:26:46 +0000 Subject: [PATCH] - added debugging log messages in g{,un}zip --- helm/http_getter/http_getter_misc.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 -- 2.39.2