#! /usr/bin/env perl

##**************************************************************
##
## Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
## University of Wisconsin-Madison, WI.
## 
## Licensed under the Apache License, Version 2.0 (the "License"); you
## may not use this file except in compliance with the License.  You may
## obtain a copy of the License at
## 
##    http://www.apache.org/licenses/LICENSE-2.0
## 
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##**************************************************************


#! /usr/bin/perl -w
use strict;
# use warnings;

# Machine info list
my ($MachineInfo) = "/common/usr/share/Info/machineinfo";
if ( defined( $ENV{MACHINE_INFO} ) )
{
    $MachineInfo = $ENV{MACHINE_INFO};
}

# Parse command line...
if ( $#ARGV == 0 )
{
    $MachineInfo = $ARGV[0];
}
elsif ( $#ARGV > 0 )
{
    print STDERR "usage: $0 [machinefile]\n";
    exit 1;
}

# Open the file...
die "can't read '$MachineInfo'" if (! open ( IN, $MachineInfo ) );
while ( <IN> )
{
    chomp;
    next if (! /\|/ );
    s/\s+\|/|/g;
    my ( $Host, $Room, $User, $Sponsor, $OS, $bldging, $Arch ) = split( /\|/ );
    print "$Host;$Room;$User;$Sponsor;$OS;$Arch\n";
}
