#!/usr/bin/perl

# Check the active file format, and report any problems.
# Don't try to fix anything, let the admin do that.
#
# John Milburn
# jem@xpat.com 95.8.12

#### =()<$active = "@<_PATH_ACTIVE>@";>()=
$active = "/var/news/etc/active";

open (ACT, "<$active")
  || die "Cannot open active file: $!";

while (<ACT>) {
	chop;
	if (/^(\S+) (\d+) (\d+) (\S+)$/) {
		($group, $hi, $lo, $mode) = ($1, $2, $3, $4);
		&badline("HiLo", $_) if ( $lo > ($hi+1) );
		&badline("Mode", $_) unless ( $mode =~ /^[yjxm]$/ );
		&badline("GroupChar", $_)
			unless ( $mode =~ /^[A-Za-z\.0-9-]+/ );
	} else {
		&badline("Format", $_);
	}
}
sub badline {
	($reas, $line) = @_;
	print STDOUT "Bad line:$reas:\n$line\n";
}
