*** checker.pl	Sun Jun 18 21:45:01 1995
--- checker2.pl	Sun Jun 18 21:45:10 1995
***************
*** 23,28 ****
--- 23,36 ----
  $reformat = 1;
  $dbdir = "../data";
  $delete = 1;
+ $checksub = 1;
+ $checkfrom = 1;
+ $checkreply = 1;
+ $checkng = 1;
+ $checkarc = 1;
+ $checkmiss = 1;
+ $checkfreq = 1;
+ $valid = 1;
  
  foreach $dir ('/usr/ucb', '/usr/bin') {
      if ($ENV{'PATH'} !~ m,(^|:)$dir($|:),) {
***************
*** 30,38 ****
      }
  }
  
! $usage = "Usage: $0 [ -new ... ] [ -nocache ] [ -noread ] [ -nosave ]
! 	[ -nosort ] [ -noreformat ] [ -nodelete ] [ -report ] [
! 	-repfile filename ] [ -mail ] [ -prompt ] [ -start num ] [
  	-end num ] [ -num num ] [ -debug ] [ -db filename ] [ -dbdir
  	directory ] [ -faqdirs directories ]\n";
  
--- 38,48 ----
      }
  }
  
! $usage = "Usage: $0 [ -new ... ] [ -days num ] [ -nocache ] [ -noread ] 
!         [ -nosave ] [ -nosort ] [ -noreformat ] [ -nodelete ] [ -report ] 
!         [ -nochecksub ] [ -nocheckfrom ] [ -nocheckreply ] [ - nocheckng ]
!         [ -nocheckarc ] [ -nocheckmiss ] [ -nocheckfreq ] [ -novalid ]
!         [ -repfile filename ] [ -mail ] [ -prompt ] [ -start num ] [
  	-end num ] [ -num num ] [ -debug ] [ -db filename ] [ -dbdir
  	directory ] [ -faqdirs directories ]\n";
  
***************
*** 42,47 ****
--- 52,62 ----
  	$new++;
  	next;
      }
+     elsif (/^-days$/) {
+         (@ARGV > 0) || die "Missing argument to \"-days\".\n$usage";
+         $new += shift;
+         next;
+     }
      elsif (/^-nocache$/) {
  	$cache = 0;
  	next;
***************
*** 66,71 ****
--- 81,118 ----
  	$delete = undef;
  	next;
      }
+     elsif (/^-nochecksub$/) {
+ 	$checksub = undef;
+ 	next;
+     }
+     elsif (/^-nocheckfrom$/) {
+ 	$checkfrom = undef;
+ 	next;
+     }
+     elsif (/^-nocheckreply$/) {
+ 	$checkreply = undef;
+ 	next;
+     }
+     elsif (/^-nocheckng$/) {
+ 	$checkng = undef;
+ 	next;
+     }
+     elsif (/^-nocheckarc$/) {
+ 	$checkarc = undef;
+ 	next;
+     }
+     elsif (/^-nocheckmiss$/) {
+ 	$checkmiss = undef;
+ 	next;
+     }
+     elsif (/^-nocheckfreq$/) {
+ 	$checkfreq = undef;
+ 	next;
+     }
+     elsif (/^-novalid$/) {
+ 	$valid = undef;
+ 	next;
+     }
      elsif (/^-report$/) {
  	$report++;
  	next;
***************
*** 461,466 ****
--- 508,514 ----
  					 *auxheaders);
  
  	if ($freq && ($freq ne $lopip_freq) &&
+             $checkfreq &&
  	    !&lopip'is_valid($records[$num], 'frequency')) {
  	    print "Wrong Frequency in $num\n" if ($debug);
  	    if (&confirm('Frequency', $lopip_freq, $freq, $num, 0)) {
***************
*** 470,475 ****
--- 518,524 ----
  	    
  	if (($lopip_reply_to = &lopip'field_value($records[$num], 
  						  'reply-to')) &&
+              $checkreply && 
  	    ($posting_reply_to = &header'field_value('reply-to', %headers)) &&
  	    ($lopip_reply_to ne $posting_reply_to) &&
  	    (! &lopip'is_valid($records[$num], 'reply-to'))) {
***************
*** 486,492 ****
  	    }
  	}
  
! 	if (($f ne $f2) && !&lopip'is_valid($records[$num], "From")) {
  	    print "Wrong From in $num\n" if ($debug);
  	    if (! &confirm("From", $f, $f2, $num, 0)) {
  		$errors .= "\t\"From:\" line in entry does not match \"From:\" line
--- 535,544 ----
  	    }
  	}
  
! 	if (($f ne $f2) && 
!             $checkfrom &&  
!             (&namestrip($f) ne &namestrip($f2)) && 
!             !&lopip'is_valid($records[$num], "From")) {
  	    print "Wrong From in $num\n" if ($debug);
  	    if (! &confirm("From", $f, $f2, $num, 0)) {
  		$errors .= "\t\"From:\" line in entry does not match \"From:\" line
***************
*** 498,504 ****
  		$f = $f2;
  	    }
  	}
! 	if (($n ne $n2) && !&lopip'is_valid($records[$num], "Newsgroups")) {
  	    print("Wrong Newsgroups in $num (", 
  		  &changed_ngs($n, $n2), ")\n") if ($debug);
  	    if (! &confirm("Newsgroups", $n, $n2, $num, 0)) {
--- 550,557 ----
  		$f = $f2;
  	    }
  	}
! 	if (($n ne $n2) && 
!             $checkng && !&lopip'is_valid($records[$num], "Newsgroups")) {
  	    print("Wrong Newsgroups in $num (", 
  		  &changed_ngs($n, $n2), ")\n") if ($debug);
  	    if (! &confirm("Newsgroups", $n, $n2, $num, 0)) {
***************
*** 511,517 ****
  		$n = $n2;
  	    }
  	}
! 	if (!&matches_oneof($s2, @s_regexp) &&
  	    !&lopip'is_valid($records[$num], "Subject")) {
  	    print "Wrong Subject in $num\n" if ($debug);
  	    if (! &multi_confirm("Subject", $s2, $num, 0, @s)) {
--- 564,570 ----
  		$n = $n2;
  	    }
  	}
! 	if (!&matches_oneof($s2, @s_regexp) && $checksub && 
  	    !&lopip'is_valid($records[$num], "Subject")) {
  	    print "Wrong Subject in $num\n" if ($debug);
  	    if (! &multi_confirm("Subject", $s2, $num, 0, @s)) {
***************
*** 523,528 ****
--- 576,582 ----
  	}
      }
      if (($n =~ /news\.answers/) && (! ($an || $naan)) &&
+         $checkarc && 
  	!&lopip'is_valid($records[$num], "Newsgroups")) {
  	print "No Archive-name in news.answers posting $num\n"
  	    if ($debug);
***************
*** 562,568 ****
      return 0 if (! $prompt);
  
      if ($replace) {
! 	print PROMPTOUT "Replace \"$old\" with \"$new\" in\n$records[$number]\n? ";
  	$do = <PROMPTIN> =~ /^y/i;
      }
      else {
--- 616,622 ----
      return 0 if (! $prompt);
  
      if ($replace) {
! 	print PROMPTOUT "Replace \"$old\" \nwith \"$new\" in\n$records[$number]\n? ";
  	$do = <PROMPTIN> =~ /^y/i;
      }
      else {
***************
*** 583,589 ****
  	    }
  	    return 1;
  	}
! 	else {
  	    print PROMPTOUT "Mark it valid? ";
  	    if (<PROMPTIN> =~ /^y/i) {
  		$records[$number] = &lopip'mark_valid($records[$number], 
--- 637,643 ----
  	    }
  	    return 1;
  	}
! 	elsif ($valid) {
  	    print PROMPTOUT "Mark it valid? ";
  	    if (<PROMPTIN> =~ /^y/i) {
  		$records[$number] = &lopip'mark_valid($records[$number], 
***************
*** 631,636 ****
--- 685,693 ----
  	}
  	return 1;
      }
+     elsif ($do =~ /^Q$/) {
+         $signal_received++;        
+     }
      elsif ($do =~ /^[0-9]+$/) {
  	if (($do > 0) && ($do <= @old)) {
  	    ($records[$number] = 
***************
*** 648,655 ****
  	}
      }
      
!     print PROMPTOUT "Mark it valid (actually, this prompt is a placebo to make this look like\nall the other times you're prompted for stuff)? ";
!     $do = <PROMPTIN>;
  
      0;
  }
--- 705,714 ----
  	}
      }
      
!     if ($valid) {
!         print PROMPTOUT "Mark it valid (actually, this prompt is a placebo to make this look like\nall the other times you're prompted for stuff)? ";
!         $do = <PROMPTIN>;
!     }
  
      0;
  }
***************
*** 692,698 ****
  As part of the maintenance of the list, I am trying to confirm the
  validity of each entry in the list.  I am doing so by comparing the
  entries in the list to the contents of the automatically generated
! posting archive on rtfm.mit.edu [18.181.0.24], which is
  accessible either via anonymous ftp in /pub/usenet or by mail, through
  requests sent to mail-server@rtfm.mit.edu.
  
--- 751,757 ----
  As part of the maintenance of the list, I am trying to confirm the
  validity of each entry in the list.  I am doing so by comparing the
  entries in the list to the contents of the automatically generated
! posting archive on rtfm.mit.edu [18.172.1.27], which is
  accessible either via anonymous ftp in /pub/usenet or by mail, through
  requests sent to mail-server@rtfm.mit.edu.
  
***************
*** 1347,1349 ****
--- 1406,1425 ----
  				      1);
      $records[$num] = &lopip'mark_hidden($records[$num], 'Posting-Record');
  }
+ 
+ sub namestrip {
+     local($raw) = @_;
+     local ($clean);
+ 
+     $clean = $raw;
+     $clean =~ s/\(.*\(.*\).*\)//;
+     $clean =~ s/\(.*\)//;
+     $clean =~ s/^.*\<//;
+     $clean =~ s/\>.*$//;
+     $clean =~ s/^ //g;
+     $clean =~ s/ $//g;
+     $clean =~ tr/A-Z/a-z/;
+     
+     return $clean;
+ }
+ 
