Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow no specification of number of hosts on the command line : uses all available...
authoreyraudl <eyraudl@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 27 Aug 2007 14:29:30 +0000 (14:29 +0000)
committereyraudl <eyraudl@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 27 Aug 2007 14:29:30 +0000 (14:29 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4121 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/gras/mutual_exclusion/simple_token/make_deployment.pl

index 5e69deb..e863a89 100755 (executable)
@@ -3,7 +3,7 @@
 use strict;
 
 my $input    = shift @ARGV || die "Usage: $ARGV[0] platform_file.xml nb_host\n";
 use strict;
 
 my $input    = shift @ARGV || die "Usage: $ARGV[0] platform_file.xml nb_host\n";
-my $nb_hosts = shift @ARGV || die "Usage: $ARGV[0] platform_file.xml nb_host\n";
+my $nb_hosts = shift @ARGV || 0;
 
 my @host;
 
 
 my @host;
 
@@ -15,6 +15,13 @@ while (<IN>) {
   push @host, $1;
 }
 
   push @host, $1;
 }
 
+die "No host found in $input. Is it really a SimGrid platform file?\nCheck that you didn't pass a deployment file, for example.\n"
+  unless (scalar @host);
+
+if (! $nb_hosts) {
+    $nb_hosts = scalar @host;
+}
+
 # map { print "$_\n" } @host;
 
 print "<?xml version='1.0'?>\n";
 # map { print "$_\n" } @host;
 
 print "<?xml version='1.0'?>\n";