view doc/ucis.ano/bgp_graph/path_list_to_xml.php @ 183:eed932f2ea7f draft

Merge git://1.0.49.10 Conflicts: doc/www.anonet2.org/public_pod/index.pod
author Nick <nick@somerandomnick.ano>
date Thu, 14 Oct 2010 03:01:24 +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;
	}
}