view doc/ucis.ano/bgp_graph/path_list_to_xml.php @ 512:bc0250f346e0 draft

new link in a2.o
author Nick <nick@somerandomnick.ano>
date Tue, 24 May 2011 21:49:53 +0000 (2011-05-24)
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;
	}
}