Line 1... |
Line 1... |
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
# $Id: isemsg_filter 550 2014-02-03 08:16:57Z mueller $
|
# $Id: xise_msg_filter 646 2015-02-15 12:04:55Z mueller $
|
#
|
#
|
# Copyright 2011-2014 by Walter F.J. Mueller
|
# Copyright 2011-2015 by Walter F.J. Mueller
|
#
|
#
|
# This program is free software; you may redistribute and/or modify it under
|
# This program is free software; you may redistribute and/or modify it under
|
# the terms of the GNU General Public License as published by the Free
|
# the terms of the GNU General Public License as published by the Free
|
# Software Foundation, either version 2, or at your option any later version.
|
# Software Foundation, either version 2, or at your option any later version.
|
#
|
#
|
Line 12... |
Line 12... |
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
# for complete details.
|
# for complete details.
|
#
|
#
|
# Revision History:
|
# Revision History:
|
# Date Rev Version Comment
|
# Date Rev Version Comment
|
|
# 2015-01-30 640 1.1.2 renamed from isemsg_filter
|
# 2014-02-01 550 1.1.1 rename --pack to --pacc (accepted is meant here)
|
# 2014-02-01 550 1.1.1 rename --pack to --pacc (accepted is meant here)
|
# 2012-01-04 450 1.1 preliminary check for par 'all constraints met'
|
# 2012-01-04 450 1.1 preliminary check for par 'all constraints met'
|
# 2011-08-14 406 1.0 Initial version
|
# 2011-08-14 406 1.0 Initial version
|
#
|
#
|
|
|
Line 41... |
Line 42... |
my $nackcnt = 0;
|
my $nackcnt = 0;
|
my $ackcnt = 0;
|
my $ackcnt = 0;
|
my $misscnt = 0;
|
my $misscnt = 0;
|
|
|
|
|
autoflush STDOUT 1; # autoflush, so noting lost on exec later
|
autoflush STDOUT 1; # autoflush, so nothing lost on exec later
|
|
|
if (exists $opts{help}) {
|
if (exists $opts{help}) {
|
print_help;
|
print_help;
|
exit 0;
|
exit 0;
|
}
|
}
|
|
|
if (!defined $type || !defined $mfsnam || !defined $lognam) {
|
if (!defined $type || !defined $mfsnam || !defined $lognam) {
|
print STDERR "%isemsg_filter-E: one of 'type mfset log' missing \n\n";
|
print STDERR "xise_msg_filter-E: one of 'type mfset log' missing \n\n";
|
print_help;
|
print_help;
|
exit 1;
|
exit 1;
|
}
|
}
|
|
|
if ($type !~ m{^(xst|tra|map|par|twr|bgn)$}) {
|
if ($type !~ m{^(xst|tra|map|par|twr|bgn)$}) {
|
print STDERR "%isemsg_filter-E: type must be xst,tra,map,par,twr, or bgn\n";
|
print STDERR "xise_msg_filter-E: type must be xst,tra,map,par,twr, or bgn\n";
|
exit 1;
|
exit 1;
|
}
|
}
|
|
|
if (read_mfs()) {exit 1;}
|
if (read_mfs()) {exit 1;}
|
if (read_log()) {exit 1;}
|
if (read_log()) {exit 1;}
|
Line 119... |
Line 120... |
}
|
}
|
|
|
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
sub read_mfs {
|
sub read_mfs {
|
if (not -r $mfsnam) {
|
if (not -r $mfsnam) {
|
print STDERR "%isemsg_filter-E: \'$mfsnam\' not existing or readable\n";
|
print STDERR "xise_msg_filter-E: \'$mfsnam\' not existing or readable\n";
|
return 1;
|
return 1;
|
}
|
}
|
|
|
open (FFILE, $mfsnam) or die "can't open for read $mfsnam: $!";
|
open (FFILE, $mfsnam) or die "can't open for read $mfsnam: $!";
|
|
|
Line 153... |
Line 154... |
}
|
}
|
|
|
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
sub read_log {
|
sub read_log {
|
if (not -r $lognam) {
|
if (not -r $lognam) {
|
print STDERR "%isemsg_filter-E: \'$lognam\' not existing or readable\n";
|
print STDERR "xise_msg_filter-E: \'$lognam\' not existing or readable\n";
|
return 1;
|
return 1;
|
}
|
}
|
|
|
open (LFILE, $lognam) or die "can't open for read $lognam: $!";
|
open (LFILE, $lognam) or die "can't open for read $lognam: $!";
|
|
|
Line 201... |
Line 202... |
}
|
}
|
|
|
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
|
|
sub print_help {
|
sub print_help {
|
print "usage: isemsg_filter [options] type mfset log\n";
|
print "usage: xise_msg_filter [options] type mfset log\n";
|
print " type log file type: xst,tra,map,par,twr, or bgn\n";
|
print " type log file type: xst,tra,map,par,twr, or bgn\n";
|
print " mfset message filter set file\n";
|
print " mfset message filter set file\n";
|
print " log log file\n";
|
print " log log file\n";
|
print " Options:\n";
|
print " Options:\n";
|
print " --pacc print summary of accepted messages\n";
|
print " --pacc print summary of accepted messages\n";
|