added command line arguments, autoconfig LD_LIBRARY_PATH on unix, added

testing of command line arguments
This commit is contained in:
cyeh%netscape.com 1999-02-26 19:09:48 +00:00
Родитель 4e65ecbaf2
Коммит 9a1c68ca7c
1 изменённых файлов: 49 добавлений и 12 удалений

Просмотреть файл

@ -1,4 +1,34 @@
#!/perl/bin/perl
#!/usr/bin/perl
$viewer_path = &ParseArgs();
if (defined($OSNAME)) {
$ostype = 'unix';
}
else {
$ostype = 'win32';
}
#FOR WINDOWS 32 PLEASE UNCOMMENT TILL ===
#system ('c:\x86rel\viewer.exe -v -d 15 -f Url.txt > result.txt');
#=================================================================
#Linux Autoconfig
if ($ostype == 'unix') {
$viewer = $viewer_path . "/viewer";
if (-e $viewer_path . "/viewer") {
$ENV{'MOZILLA_HOME'}=$viewer_path;
$ENV{'LD_LIBRARY_PATH'}=$viewer_path;
system ($viewer_path . '/viewer -v -d 9 -f ./url.txt > result.txt');
}
else {
die $viewer_path . "/viewer doesn't exist! Check your path.\n";
}
}
#=================================================================
open (ANALYSIS_FILE, '>analysis.html');
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)=localtime(time);
%weekday= (
@ -34,16 +64,6 @@ print (ANALYSIS_FILE "<BR>\n");
print (ANALYSIS_FILE "<BR>\n");
print (ANALYSIS_FILE "<HR>\n");
#FOR WINDOWS 32 PLEASE UNCOMMENT TILL ===
system ('c:\x86rel\viewer.exe -v -d 15 -f Url.txt > result.txt');
#=================================================================
#FOR LINUX PLEASE UNCOMMENT TILL ===
#$ENV{'MOZILLA_HOME'}='/u/phillip/seamonkey/linux/package';
#$ENV{'LD_LIBRARY_PATH'}='/u/phillip/seamonkey/linux/package';
#system ('/u/phillip/seamonkey/linux/package/viewer -v -d 9 -f /tmp/bindu/Url.txt > result.txt');
#=================================================================
open (IN_FILE, '<result.txt');
open (OUT_FILE, '>loaded.txt');
open (URL_FILE, '<Url.txt');
@ -189,4 +209,21 @@ close (URL_FILE);
close (IN_FILE);
close (OUT_FILE);
close (NOMATCH_FILE);
close (ANALYSIS_FILE);
close (ANALYSIS_FILE);
sub ParseArgs {
my($i);
if( (@ARGV == 0) || (@ARGV > 1) ) {
&PrintUsage;
}
else {
$viewer_path = $ARGV[0];
}
return $viewer_path;
}
sub PrintUsage {
die "usage: LoadUrl.pl <directory containing viewer app>";
}