summaryrefslogtreecommitdiff
path: root/d/sys/lampion/local/bin/scan-svnco
blob: 7b087e7d739d8dadbe9c4e10390afac4ec1cf5d7 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/perl -w
#
# Ceci est un script sur mesure pour update-scnco.
#
use strict;

sub find_files
{
    my ($dir, $want) = @_;
    local $_;
    my $d;
    # Look for a Makefile.
    if (-f "$dir/Makefile")
    {
	print $dir, "\n" if $want eq 'make';
	# Only html keep running.
	return unless $want eq 'html';
    }
    # For each file.
    if (opendir $d, $dir)
    {
	while ($_ = readdir $d)
	{
	    my $f = $dir . '/' . $_;
	    # Skip ., .., and hidden files.
	    next if /^\./;
	    # Skip Doxygen dirs.
	    next if $_ eq 'html';
	    # Skip robot www dir.
	    next if $_ eq 'www';
	    # Recurse to subdirs.
	    if (-d $f)
	    {
		find_files ($f, $want);
	    }
	    # Find (aft) text files or recent html files.
	    elsif ($want eq 'txt' && /\.txt$/
	           || $want eq 'html' && /\.html$/ && -M $f < 10)
	    {
		print $f, "\n";
	    }
	}
	closedir $d;
    }
}

if (scalar @ARGV != 1 || $ARGV[0] !~ /^(?:make|txt|html)$/)
{
    print <<EOF;
scan-svnco - scan a svn check out and find interresting files or directories.
scan-svnco txt|make|html
EOF
    exit 1;
}

find_files ('.', @ARGV);