#!/usr/bin/perl -w # nerxscode # Time-stamp: <2001-07-14 19:06:56 nik@nerxs.com> # testnerxs.pl # This thing tests if there are errors in nerxsfiles. $| = 1; # Output autoflush $i = 0; if ($i != 0) { print "\n"; $i++; } if ($ARGV[0]) { $path = $ARGV[0]; open(FH, "+< $path") or die "could not open $path: $!"; while() { foreach ($_) { $line = $_; if ($line ne "") { &readnline($line, $path); } } } } else { while () { $path = $_; open(FH, "+< $path") or die "could not open $path: $!"; while() { foreach ($_) { $line = $_; if ($line ne "") { &readnline($line, $path); } } } } } sub readnline { chomp ($path); if ($_ ne "\n") { ($key, $val) = /^(\w+):\s*(.*)$/; if ($key eq "") { print "ERROR: \'$path\' leerer Key ($val).\n"; print "Zeile: $_\n"; exit 0; } elsif ($val eq "") { if ($key ne "HASH") { print "ERROR: \'$path\' leerer Value ($key).\n"; } } } else { print "ERROR: \'$path\' leere Zeile.\n"; exit 0; } }