chiark / gitweb /
stuff from chiark:/usr/local/src/misc/ (as found)
[chiark-utils.git] / scripts / cvsweb-list~
diff --git a/scripts/cvsweb-list~ b/scripts/cvsweb-list~
new file mode 100755 (executable)
index 0000000..124235a
--- /dev/null
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+
+print <<END or die $!;
+Content-Type: text/html
+
+<head>
+<title>chiark public CVS</title>
+<link rev="made" href="mailto:webmaster\@chiark.greenend.org.uk">
+</head>
+<body>
+<h1>list of users exporting CVS repositories via cvsweb from chiark</h1>
+<ul>
+END
+
+open UL, "/etc/userlist" or die $!;
+while (<UL>) {
+    next if m/^\#/ or !m/\S/;
+    chomp($user= $_);
+    next unless readlink "/home/$user/public-cgi/cvsweb"
+       eq '/usr/local/lib/cvsweb';
+    $hd= 0;
+    $pc= "/home/$user/public-CVS/";
+    next unless opendir D, $pc;
+    while (defined($mod= readdir D)) {
+       next unless -d "$pc/$mod";
+       next if $mod =~ m/^\./;
+       if (!$hd) {
+           print "<li><A href=\"/ucgi/~$user/cvsweb\">$user</A>" or die $!;
+           print " (<A href=\"/~$user/\">homepage</A>)" or die $!
+               if -d "/home/$user/public-html";
+           print ":" or die $!;
+           $hd= 1;
+       } else {
+           print "," or die $!;
+       }
+       print " <A href=\"/ucgi/~$user/cvsweb/$mod/\">$mod</A>" or die $!;
+    }
+    next unless $hd;
+    print "</li>\n" or die $!;
+}
+
+close UL or die $!;
+
+print <<END or die $!;
+</ul>
+<hr>
+<ADDRESS>
+  maintained by
+  <A HREF="mailto:$ENV{SERVER_ADMIN}">$ENV{SERVER_ADMIN}</A>;
+  <A href="/">chiark home page</A>
+</ADDRESS>
+</body>
+END
+
+exit 0