# -*- Perl -*-
#
# $Id: rfccheck,v 1.3 2000/11/15 16:28:45 sra Exp $
#
# Check line and page length limits of a file for compliance with RFC-1111.

use strict;
use integer;

my $maxline = 72;
my $maxpage = 58;

my $ph = 0;

while (<>) {
    chomp;
    if (length($_) > $maxline) {
	printf("%s:%d: line too long: %s\n", $ARGV, $., $_);
    }

    if (//) {
	$ph = $. + 1;
    }

    if (($. - $ph) > $maxpage && /\[Page [0-9]*\]$/) {
	printf("%s:%d: page too long: %s\n", $ARGV, $., $_);
    }
}
