]> matita.cs.unibo.it Git - helm.git/commitdiff
Now mywget is used instead of wget. mywget is a wrapper for wget
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 13 Dec 2000 12:01:28 +0000 (12:01 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 13 Dec 2000 12:01:28 +0000 (12:01 +0000)
that recognizes also file:/... URLs.

helm/interface/getter.ml
helm/interface/mywget [new file with mode: 0755]

index d79409c8933f8181e432f1b1d5b6ff73d84a2f71..d3da5a579da24f566d5f26eace108518226cfd61 100644 (file)
@@ -20,7 +20,7 @@ module MapOfStrings = Map.Make(OrderedStrings);;
 
 let read_index url =
  let module C = Configuration in
-  if Sys.command ("wget -c -P " ^ C.tmpdir ^ " " ^ url ^ "/\"" ^
+  if Sys.command ("./mywget " ^ C.tmpdir ^ " " ^ url ^ "/\"" ^
    C.indexname ^ "\"") <> 0
   then
    raise (ErrorGetting url) ;
@@ -108,7 +108,7 @@ let get_file uri =
     begin
      let url = url_of_uri uri in
       (*CSC: use -q for quiet mode *)
-      if Sys.command ("wget -c -P " ^ dir ^ " \"" ^ url ^"\"") <> 0
+      if Sys.command ("./mywget " ^ dir ^ " \"" ^ url ^"\"") <> 0
       then
        raise (ErrorGetting url) ;
     end ;
diff --git a/helm/interface/mywget b/helm/interface/mywget
new file mode 100755 (executable)
index 0000000..c6f3205
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/perl
+
+if ($#ARGV != 1) {
+ print STDERR "Usage: mywget prefix URL\n";
+ exit -1;
+}
+
+my ($prefix,$URL) = @ARGV;
+if ($URL =~ /^file:\//) {
+ $URL =~ s/^file:\///;
+ my $command = "mkdir -p $prefix ; cp $URL $prefix";
+ print "$command\n";
+ system($command) == 0
+  or die "\"$command\" error";
+} else {
+ my $command = "wget -c -P $prefix $URL";
+ system($command) == 0
+  or die "\"$command\" error";
+}