Script to convert funk to fr dictionaries
authorAlan T. DeKok <aland@freeradius.org>
Tue, 19 Aug 2008 16:44:49 +0000 (18:44 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 19 Aug 2008 16:44:49 +0000 (18:44 +0200)
share/dct2fr [new file with mode: 0755]

diff --git a/share/dct2fr b/share/dct2fr
new file mode 100755 (executable)
index 0000000..3a83c85
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+#
+#      Horrible hack to convert Funk dictionaries to FreeRADIUS ones.
+#
+#      It won't convert everything, and the files still need to be
+#      edited afterwards, but it's a start.
+#
+#      ./dct2fr foo.dct > dictionary.foo
+#      vi dictionary.foo
+#              replace 'foo' with the real vendor name
+#      ./format.pl dictionary.foo
+#
+
+while (<>) {
+    if (/^MACRO\s+([^ \t\(]+)\(t,s\)\s+26\s+\[vid=(\d+)\s+type1=\%t\%\s+len1=\+2\s+data=\%s\%/) {
+       $name = $1;
+       $vendor = $2;
+
+       print "BEGIN-VENDOR foo $2\n";
+    }
+
+#    if (/^ATTRIBUTE\s+([^ \t]+)\s+$name\s*\((\d+),s+(\w+)\)/i) {
+
+    if (/^ATTRIBUTE\s+([^ \t]+)\s+$name\s*\((\d+)\s*,\s*(\w+)/i) {
+       print "ATTRIBUTE $1 $2 $3\n";
+    }
+}
+
+print "END-VENDOR foo\n";