#!/usr/bin/perl

my $EXIT_VALUE = 0;
my $machine = `/usr/sbin/sysctl -n hw.machine`;
my $byteorder = `/usr/sbin/sysctl -n hw.byteorder`;

if ( $machine !~ "x86" && $byteorder !~ "1234" )
{
        # G3s are not compatible
        if(CheckIOReg("PowerPC,750@", "PowerPC,755@", "PowerPC,740@",
                "PowerPC,745@", "PowerPC,750CX@", "PowerPC,750CXe@",
                "PowerPC,G3@")) {
                $EXIT_VALUE = ((1 << 6) | ( 1 << 5 ) | 13 );
        }
}

exit($EXIT_VALUE);

sub CheckIOReg
{   
        $RESULT = 0;
    
        open(IOREGOUT, "/usr/sbin/ioreg |");
    
        foreach $LINE (<IOREGOUT>) {
                $BUF .= $LINE;
        }
        close(IOREGOUT);
    
        foreach $ITEM (@_) {
                if($BUF =~ /$ITEM/g) {
                        $RESULT = 1;
                        last;
                }
        }
    
        return($RESULT);
}   
