/[ldap.old]/ldif2dot
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /ldif2dot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Fri May 26 16:19:19 2000 UTC (18 years, 10 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +24 -6 lines
multi-line support, filter

1 #!/usr/local/bin/perl -w
2
3 undef $filter;
4
5 sub filter {
6 my ($dn) = @_;
7 return $dn =~ /o=agrokor.hr/i && $dn !~ /o=NetscapeRoot/;
8 }
9
10 print "digraph ldif {\n";
11
12 $line=<>; chomp $line;
13
14 while($nline=<>) {
15 chomp $nline;
16 while ($nline=~/^ (.*)$/) {
17 $line.=$1;
18 $nline=<>; chomp $nline;
19 }
20 # print STDERR "$line\n\n";
21 if ($line =~ /^dn: *(.*)$/ && filter($1)) {
22 my $dn=$1;
23 $dn=~s/"//g; # nuke quotes
24 print STDERR "$dn\n";
25 @dn=split(/, */,$dn);
26 undef $lval; # last value
27 foreach (@dn) {
28 ($el,$val) = split (/= */,$_);
29 next if ($el eq "uid");
30 if (!defined($exist{$val})) {
31 $exist{$val}++;
32 }
33 if ($lval && !defined($conn{"$val,$lval"})) {
34 print "\"$val\" -> \"$lval\";\n";
35 $conn{"$val,$lval"}++;
36 }
37 $lval = $val;
38 }
39 }
40 $line=$nline;
41 }
42
43 print "}\n";

  ViewVC Help
Powered by ViewVC 1.1.26