#!/usr/bin/perl -w
#
# $Id: names.pl,v 1.1 2003/09/03 18:25:07 danbri Exp $
# Quick hack to extract link targets from an Overview.html 
# danbri@w3.org

my $spec = shift;

die "No file named" unless $spec;

die "File doesn't exist" if ! -e $spec;

my $doc='';
my %targets;
open(IN,$spec) || die "Can't open file: $spec";
while(<IN>) { $doc .= $_;}
close IN;

while( $doc =~ s/name\s*=\s*"([^"]+)"/gotname($1)/ige) {};
while( $doc =~ s/id\s*=\s*"([^"]+)"/gotname($1)/ige) {};

sub gotname {
  my $name=shift;
#  print "$name\n";
  chomp  $name;
  $target{$name}=1;
}

foreach my $id (sort keys %target) {
  print "$id\n";
}
