3
# Create a dot(1) graph file from a directory hierarchy
5
# (C) Copyright 2001 Diomidis Spinellis.
7
# Permission to use, copy, and distribute this software and its
8
# documentation for any purpose and without fee is hereby granted,
9
# provided that the above copyright notice appear in all copies and that
10
# both that copyright notice and this permission notice appear in
11
# supporting documentation.
13
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
14
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
15
# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17
# $Id: dirgraph.pl,v 1.1 2001/11/28 18:01:36 ellson Exp $
20
print "#!/usr/local/bin/dot
21
# Automatically generated file.
22
# Contains the directory representation of $ARGV[0] generated by $0
28
print STDERR "$0: usage $0 directory\n";
32
$unix = (-r '/dev/null');
35
open(IN, $cmd = "find $ARGV[0] -type d -print|") || die "Unable to run $cmd: $!\n";
38
open(IN, $cmd = "dir /b/ad/s $ARGV[0]|") || die "Unable to run $cmd: $!\n";
44
@paths = split(/\//, $_);
46
@paths = split(/\\/, $_);
53
$name =~ s/[^a-zA-Z0-9]/_/g;
55
$edge{"$op->$name;"} = 1 if ($op);
63
node [height=.15,shape=box,fontname="Helvetica",fontsize=8];
64
edge [arrowhead=none,arrowtail=none];
68
for $i (sort keys %node) {
69
print "\t$i [label=\"$node{$i}\"];\n";
71
for $i (sort keys %edge) {