1:
2# draw directory tree
3tw -P -e "
4begin:	printf('digraph tw { rankdir=LR\n');
5end:	printf('}\n');
6action:	if (type == LNK)
7	{
8		status = FOLLOW;
9		local = 1;
10	}
11	else
12	{
13		printf('n%d_%ld_%d [ shape= ', dev, ino, visit);
14		if (local) printf('diamond');
15		else if (type == NS) printf('plaintext');
16		else if (type == DIR) printf('ellipse');
17		else printf('box');
18		printf(' label=\"%s\" ]\n', name);
19		if (level > 0) printf('n%d_%ld_0 -> n%d_%ld_%d\n',
20				parent.dev, parent.ino, dev, ino, visit);
21		if (visit > level)
22		{
23			if (visit == level + 1)
24				printf('{ rank=same n%d_%ld_%d n%d_%ld_0 }\n',
25					dev, ino, dev, ino, visit);
26			printf('n%d_%ld_%d -> n%d_%ld_0 [ style=dotted ]\n',
27					dev, ino, dev, ino, visit);
28		}
29	}
30" "$@"
31