Mercurial > hg > anonet-resdb
diff doc/ucis.ano/bgp_graph/path_list_to_xml.php @ 28:4dbe5bf653bb draft
Added bgp graph scripts
author | ivo <ivo@UFO-Net.nl> |
---|---|
date | Thu, 10 Jun 2010 00:15:51 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/ucis.ano/bgp_graph/path_list_to_xml.php Thu Jun 10 00:15:51 2010 +0200 @@ -0,0 +1,17 @@ +#!/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; + } +}