view doc/ucis.ano/bgp_graph/path_list_to_xml.php @ 538:3247a742e3f8 draft

peer2anonet: Sun Jul 10 07:25:42 CDT 2011 - d3v1150m471c * security checks, whitespace removed after some data
author d3v1150m471c <d3v11@d3v1150m471c.ano>
date Sun, 10 Jul 2011 07:26:48 -0500
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;
	}
}