From owner-freebsd-questions@FreeBSD.ORG Thu Jun 26 20:13:07 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 70B6F37B401 for ; Thu, 26 Jun 2003 20:13:07 -0700 (PDT) Received: from gull.mail.pas.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id C024B43FE9 for ; Thu, 26 Jun 2003 20:13:06 -0700 (PDT) (envelope-from parv_fm@mailsent.net) Received: from sdn-ap-014dcwashp0096.dialsprint.net ([63.188.136.96] helo=moo.holy.cow) by gull.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 19Vjfd-0002rR-00 for freebsd-questions@freebsd.org; Thu, 26 Jun 2003 20:13:06 -0700 Received: by moo.holy.cow (Postfix, from userid 1001) id D7448A83C; Thu, 26 Jun 2003 23:16:12 -0400 (EDT) Date: Thu, 26 Jun 2003 23:16:12 -0400 From: parv To: f-questions Message-ID: <20030627031612.GA92994@moo.holy.cow> Mail-Followup-To: f-questions References: <20030619074104.GA70732@moo.holy.cow> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030619074104.GA70732@moo.holy.cow> Subject: Re: mozilla is started instead of genuine netscape while opening a new window X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jun 2003 03:13:07 -0000 in message <20030619074104.GA70732@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/