#!/usr/bin/perl # usage: generate-raddb radius-server/raddb/dictionary* >raddb.pm # i.e.: generate-raddb ~/src/freeradius-0.2/raddb/dictionary* >FS/raddb.pm print <) { next if /^(#|\s*$|\$INCLUDE\s+)/; next if /^(VALUE|VENDOR|BEGIN\-VENDOR|END\-VENDOR)\s+/; /^(ATTRIBUTE|ATTRIB_NMC)\s+([\w\-]+)\s+/ or die $_; $attrib = $2; $dbname = lc($2); $dbname =~ s/\-/_/g; $hash{$dbname} = $attrib; #print "$2\n"; } foreach ( keys %hash ) { # print "$_\n" if length($_)>24; # print substr($_,0,24),"\n" if length($_)>24; # $max = length($_) if length($_)>$max; #everything >24 is still unique, at least with freeradius comprehensive dataset print " '". substr($_,0,24). "' => '$hash{$_}',\n"; } print <