#!/opt/SUNWstade/bin/perl -I/opt/SUNWstade/lib

use System;
use TO;
use Getopt::Std;
use Layout;

System->set_home("/opt/SUNWstade");


sub usage {
  print <<EOF;

  Usage: auto_layout -t topo -p passes -r row_size
  Example: auto_layout -t MERGE-MASTER -p 4 -r 9

EOF
}


if (!getopts("r:p:t:h", \%opts) || $opts{h} || !$opts{t} ) {
     &usage();
     exit;
}


$name     = $opts{t};
$passes   = $opts{p} || 5;
$row_size = $opts{r} || 7;

$to = TO->readExistingTopo($name);

$layout   = 1;
$width    = undef;
$height   = 800;

Layout->shortest_route($name, $to, undef, undef, 
        $width,  $height ,
        $layout, $row_size, {CLI => 1, PASSES => $passes} ) ;



