summaryrefslogtreecommitdiffstats
path: root/www/irc/irclogs.pl
blob: b2e5f59642c14caa53cd63fe410610f43ce145dc (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
#!/usr/bin/perl

require "/home/dast/perl/date.pm";

opendir(DIR, ".") or
    die "Can't opendir()";
@logs = sort grep { /^rockbox-/ } readdir(DIR);
closedir DIR;

print "<table class=archive>\n";

$lasty = 0;
$lastm = 0;
$count = 0;

for ( @logs ) {
    $size = (stat("$_"))[7];
    $file = $_;
    $log = "";

    if (/-(\d+)/) {
       if ( $1 =~ /(\d\d\d\d)(\d\d)(\d\d)/ ) {
            $y = $1;
            $m = $2;
            $d = $3;

            $mname = ucfirst MonthNameEng($m);
            if ($y != $lasty) {
                print "</tr><tr>\n" if $lasty != 0;
                print "<th>$y</th>\n";
                $lasty = $y;
            } else {
                print "</tr><tr>\n<th></th>" if ( $m != $lastm );
            }

            if ( $m != $lastm ) {
                $count=0;
                print "<th>$mname</th>\n";
                $lastm = $m;
            }

            print "<td><a test href=\"$file\">$d</a></td>\n";

            if ( ++$count > 15 ) {
                print "</tr><tr><th></th><th></th>\n";
                $count=0;
            }
        }
    }
}
print "</ul></td></tr></table>\n";