[1129] | 1 | #!/usr/bin/perl -w
|
---|
[845] | 2 |
|
---|
| 3 | ###########################################################################
|
---|
| 4 | #
|
---|
| 5 | # urldownload.pl --
|
---|
| 6 | # A component of the Greenstone digital library software
|
---|
| 7 | # from the New Zealand Digital Library Project at the
|
---|
| 8 | # University of Waikato, New Zealand.
|
---|
| 9 | #
|
---|
| 10 | # Copyright (C) 1999 New Zealand Digital Library Project
|
---|
| 11 | #
|
---|
| 12 | # This program is free software; you can redistribute it and/or modify
|
---|
| 13 | # it under the terms of the GNU General Public License as published by
|
---|
| 14 | # the Free Software Foundation; either version 2 of the License, or
|
---|
| 15 | # (at your option) any later version.
|
---|
| 16 | #
|
---|
| 17 | # This program is distributed in the hope that it will be useful,
|
---|
| 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 20 | # GNU General Public License for more details.
|
---|
| 21 | #
|
---|
| 22 | # You should have received a copy of the GNU General Public License
|
---|
| 23 | # along with this program; if not, write to the Free Software
|
---|
| 24 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 25 | #
|
---|
| 26 | ###########################################################################
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | # This program will download the specified urls (http:, ftp: and file:)
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | BEGIN {
|
---|
| 33 | die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
|
---|
| 34 | unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
|
---|
| 35 |
|
---|
| 36 | unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/lib");
|
---|
| 37 | $ENV{'PATH'} = "$ENV{'GSDLHOME'}/perllib/cpan/bin:$ENV{'PATH'}";
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | my @quoted_argv = map { "\"$_\"" } @ARGV;
|
---|
| 41 |
|
---|
| 42 | my $args = join(' ', @quoted_argv);
|
---|
| 43 | $cmd = "w3mir $args";
|
---|
| 44 |
|
---|
| 45 | my $status = system($cmd);
|
---|
| 46 | $status /= 256;
|
---|
| 47 | if ($status != 0)
|
---|
| 48 | {
|
---|
| 49 | print STDERR "Error: failed to execute $cmd\n";
|
---|
| 50 | exit($status);
|
---|
| 51 | }
|
---|
| 52 |
|
---|