Xref: feenix.metronet.com news.software.nn:1038
Newsgroups: news.software.nn
Path: feenix.metronet.com!news.ecn.bgu.edu!usenet.ins.cwru.edu!howland.reston.ans.net!noc.near.net!uunet!mdisea!uw-coco!nwnexus!camco1!bill
From: bill@Celestial.COM (Bill Campbell)
Subject: Re: Unbatcher Out of Sync?
Organization: Celestial Software, Mercer Island, WA
Date: Thu, 29 Jul 1993 02:47:09 GMT
Message-ID: <1993Jul29.024709.21150@Celestial.COM>
References: <CAtu8F.CHE@wyn386.mi.org>
Lines: 84

In <CAtu8F.CHE@wyn386.mi.org> ken@wyn386.mi.org (Ken Jongsma Guest Login) writes:

:We're running the performance release of cnews and lately we've started
:to get these messages on just about a daily basis.

:Please excuse me if this is a FAQ, but would someone mind telling me
:what causes them and how I can eliminate them?

This is a cnews problem, not nn.

That aside, the problem is that characters have been
dropped/added in the incoming batch file.  Each article has a
header of the form:
#! rnews 1885
where the 1885 above is the length of the article, thus I should
be able to seek ahead 1885 characters and find another header:
#! rnews 1176

The problem arises when the character count is incorrect between
the two messages.  The enclosed perl script reads a batch and
prints the #! rnews headers until it finds one out of sync.

I use this to scan a batch to see where the last good header was
found then edit the file manually to add/delete characters to get
it back in sync.

Bill

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  chklength.pl
# Wrapped by bill@camco1 on Wed Jul 28 19:46:51 1993
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'chklength.pl' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'chklength.pl'\"
else
echo shar: Extracting \"'chklength.pl'\" \(498 characters\)
sed "s/^X//" >'chklength.pl' <<'END_OF_FILE'
X:
X#!/usr/local/bin/perl
Xeval ' exec $LOCAL/bin/perl $0 "$@" '
X	if $running_under_some_shell;
X	shift if(join("", @ARGV) eq ""); # Xenix Kludge
X
X$\ = "\n";	# use newlines as separators.
X
Xfor(@ARGV) {
X	$file = $_;
X	open(INPUT, $file) || &usage("open($file) failed");
X	print STDERR "processing $file";
X	while(<INPUT>) {
X		chop;
X		if(/^#!\s+rnews\s+(\d+)$/) {
X			$len = $1;
X			seek(INPUT, $len, 1);
X			print STDERR;
X		}
X		else {
X			print "out of sync";
X			print STDERR;
X			exit;
X		}
X	}
X	close(INPUT);
X}
END_OF_FILE
if test 498 -ne `wc -c <'chklength.pl'`; then
    echo shar: \"'chklength.pl'\" unpacked with wrong size!
fi
chmod +x 'chklength.pl'
# end of 'chklength.pl'
fi
echo shar: End of shell archive.
exit 0
-- 
INTERNET:  bill@Celestial.COM   Bill Campbell; Celestial Software
UUCP:   ...!thebes!camco!bill   8545 SE 68th Street
             uunet!camco!bill   Mercer Island, WA 98040; (206) 947-5591
SPEED COSTS MONEY -- HOW FAST DO YOU WANT TO GO?
