#!/usr/bin/perl
# ARG tmpfile


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

my $tmpname=shift @ARGV;
(-f $tmpname ) || die "Fichier '$tmpname' non trouv\n";
open( TMP, ">$tmpname") or die "Fichier $tmpname non modifiable\n";

my $host = shift(@hostlist);
foreach $subdomain ('', @domainlist) {
	print TMP "$subdomain:";
	while ( $host && $hostlist{$host}{'subdomain'} eq $subdomain) {
		print TMP $hostlist{$host}{'basename'} if ($hostlist{$host}{'type'} ne 'dongle');
		$host = shift(@hostlist);
		print TMP " " if ($host);
	}
	print TMP "\n";
}
close TMP;
`chown pulse2. $tmpname`;

exit 0;
