aboutsummaryrefslogtreecommitdiffstats
path: root/mbd/make-mbd-nets.pl
diff options
context:
space:
mode:
authorJoachim Tingvold <joachim@tingvold.com>2014-04-06 03:11:04 +0200
committerJoachim Tingvold <joachim@tingvold.com>2014-04-06 03:11:04 +0200
commit2a0c0a3dbbdf7fa5040953c0b0d88ad6f62c011e (patch)
tree92c7cbf54272466b46f64e5dc8d1ddb429858836 /mbd/make-mbd-nets.pl
parentfe0be5960aac1f9bb600dbf853d862a9f4e60de8 (diff)
Initial commit. Source; TG13-goodiebag.
Diffstat (limited to 'mbd/make-mbd-nets.pl')
-rw-r--r--mbd/make-mbd-nets.pl26
1 files changed, 26 insertions, 0 deletions
diff --git a/mbd/make-mbd-nets.pl b/mbd/make-mbd-nets.pl
new file mode 100644
index 0000000..6af76f0
--- /dev/null
+++ b/mbd/make-mbd-nets.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -I /root/tgmanage/
+use strict;
+use warnings;
+
+unless (@ARGV > 0) {
+ print "No arguments. Need netlist.txt.\n";
+ exit 1;
+}
+
+my $n = open(NETLIST, "$ARGV[0]") or die ("Cannot open netlist.txt");
+
+print "# Autogenerated. Do not touch!\n";
+print "package Config;\n";
+print "our \@networks = (\n";
+
+while(<NETLIST>) {
+ next if /^(.*#|\s+$)/; # skip if comment, or blank line
+
+ chomp;
+ my ($network, $prefix, $switchname, undef) = split;
+
+ print "\t\"$network/$prefix\",\n";
+}
+
+print ");\n";
+print "1;\n";