view doc/ucis.ano/bgp_graph/path_list_to_xml.php @ 1037:d956fda85e70 draft

[db/dom/ano/freeanons/ns/a.ns.d3v11.ano] moving mirror
author d3v11 <d3v11@d3v11.ano>
date Mon, 15 Oct 2012 00:21:50 +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;
	}
}