view doc/ucis.ano/bgp_graph/path_list_to_xml.php @ 429:ef59edb1e7b9 draft

Merge commit '8d7dd4b15f9687d2a7e2d980a20ea47691454d3a'
author Nick <nick@somerandomnick.ano>
date Tue, 08 Mar 2011 16:36:45 +0000
parents 4dbe5bf653bb
children
line wrap: on
line source

#!/usr/bin/php
<?php
$nodes = array();

$file = STDIN;

while (!feof($file)) {
	$line = stream_get_line($file, 1024, "\n");
	if ($line === NULL) break;
	if (!strlen($line)) continue;
	$pathnodes = explode(' ', $line);
	$prevnode = NULL;
	foreach ($pathnodes as $node) {
		if ($node && $prevnode) print('<link from="'.$node.'" to="'.$prevnode.'" total="1" />'."\n");
		$prevnode = $node;
	}
}