#!/usr/bin/perl
use strict;

use FindBin qw($Bin);
my $MyBin = "$Bin/../../../";
$ENV{PERLIB} = (length($ENV{PERLIB})? "$ENV{PERLIB}:" : '')
    . "$MyBin/perl/common-inc/:$MyBin/perl/fallback-inc/";
chdir $MyBin;

my ($op) = @ARGV;
my $showlogo_args;

if ($op eq 'start')
{
    my $binsuffix= (index(`uname -a`,'i386')>0) ? 'x86' : 'ppc';
    if (-r "splash.bmp")
    {
	my $pid;
	if ( ($pid=fork()) )
	{
	    $showlogo_args = " _showlogo_pid $pid ";
	} else {
	    if ($pid==0)
	    {
		exec("$Bin/showlogo-osx-${binsuffix}",'');
		exit(0);
	    }
	};
    };        
}


my $other_args = $op ? " command $op " : "";
if ($op eq 'start')
{
    $other_args = ' _osxtrayicon_pid ' . getppid() . " ";
}


my $s = system("perl site/stunnixwebsrv/startsite.pl ${showlogo_args} ${other_args}");
    
