#!/usr/bin/perl
# ARG @mac name


require '/usr/lib/kwartz/control/sharelib.pl'; 	 
require 'hostlib.pl'; 	 #load host management library
require 'deploy.pl'; 	 #load host management library

my $mac=shift @ARGV;
my $hostname=shift @ARGV;
my $file = "/var/kwartz/newhosts.pulse";
my @newhosts;
my $found = 0;

$mac=uc($mac);

die "$errmes\n" if $errmes=&MacAddressValid($mac);

if (-f $file) {
	open FILE, "<$file";
	@newhosts = <FILE>;
	close FILE;
}

foreach (@newhosts) {
	$found++ if (m/$mac/);
}

if ($found == 0) {
	system ("echo \"$hostname|$mac\" >> $file");
}

exit 0;
