summaryrefslogtreecommitdiff
path: root/dviware/catdvi/cvsparser.pl
blob: 325a617505324be052571bedd59cb888af1e708b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl -w
# Written by Antti-Juhani Kaijanaho for the GZigZag project

use strict 'vars';

sub main {
    my @dirs = ();
    my $dn = "";
    push @dirs, ".";
    DIRS : while ($#dirs >= 0) {
        $dn = pop @dirs;
        print STDERR "Finding files in `$dn'...";
        open(ENTRIES, "<$dn/CVS/Entries") || next DIRS;
        while (<ENTRIES>) {
            if (m|^(D?)/([^/]+)/([0-9]+(\.[0-9]+)*)?/[^/]*/[^/]*/.*$|) {
                my $dir = ($1 eq "D");
                my $name = $2;
                if ($dir) {
                    push @dirs, "$dn/$name";
                } else {
                    print "$dn/$name\n";
                }
            } elsif (/^D$/) {
                # ignore
            } else {
                print STDERR "###$_###";
                die "syntax error"
            }
        }
        close(ENTRIES);
        print STDERR "done.\n";
    }
}
main();