mozilla is started instead of genuine netscape while opening a
new window
parv
parv_fm at emailgroups.net
Thu Jun 26 20:13:07 PDT 2003
in message <20030619074104.GA70732 at moo.holy.cow>, wrote parv
thusly...
>
> Problem does not happen when the genuine netscape is not running.
> In that case, it is started anew. In addition, mozilla doesn't
> start if its is not already running.
>
> Say, i have /both/ mozilla & netscape running. If i want to open
> a new window of the genuine netscape, thru netscape-wrapper,
> a mozilla window is opened instead of navigator's.
Since nobody has replied, allow me to share the /workaround/, not a
real solution to the problem, which calls "netscape", from
netscape-wrapper port, only when mozilla is not
An optional URI is the only argument it takes/uses on the command
line. It assumes that linux-netscape-navigator-4.8 port has been
installed.
#!/usr/local/bin/perl -w
use strict;
# regex to identify desired processes in ps output
my $moz =
{ 're' => qr/^ [^\s]+ \b mozilla-bin \b/x
, 'exists' => 0
};
my $netscape =
{ 're' => qr/^ [^\s]+ \b navigator-linux-\d+\.\d+\.bin \b/x
, 'exists' => 0
};
exec_netscape( $moz , $netscape );
sub exec_netscape
{ my ($moz , $netscape) = @_;
# "⊂" usage is INTENTIONAL
&find_proc;
my @ex;
push @ex
, $moz->{'exists'} ? 'navigator-linux-4.8' : 'netscape'
;
if ($netscape->{'exists'})
{ push @ex
, qw{ -irix-session-management -remote }
, ( !scalar @ARGV
? qw{ 'xfeDoCommand(openBrowser)' }
: qw{ 'openURL( }
. +(shift @ARGV)
. " , new-window)'"
)
;
}
system "@ex &"
and die "@ex failed: $? $!\n";
}
sub find_proc
{ my @proc = qx/ps -axww/ or die "'ps -axww' failed: $!\n";
chomp @proc;
foreach my $h (@_)
{ next if $h->{'exists'};
foreach my $p (@proc)
{ last if $h->{'exists'};
++$h->{'exists'}
if (split ' ' , $p , 5 )[-1] =~ m/ $h->{'re'} /x;
}
}
}
__END__
Happy programming!
- Parv
--
A programmer, budding Unix system administrator, and amateur photographer
ISO employment...
http://www103.pair.com/parv/work/
More information about the freebsd-questions
mailing list