From:	CRDGW2::CRDGW2::MRGATE::"SMTP::UUNET.UU.NET::CCAVAX!GLASSMANN"  6-SEP-1989 12:33
To:	MRGATE::"ARISIA::EVERHART"
Subj:	NEWS_RNEWS.COM for other compressed files

Message-Id: <5684@ccavax.camb.com>
Received: from uunet.uu.net by DRYCAS.CLUB.CC.CMU.EDU; Wed, 6 Sep 89 11:51 EDT
Received: from ccavax.UUCP by uunet.uu.net (5.61/1.14) with UUCP id AA02942;
 Wed, 6 Sep 89 11:49:31 -0400
Date: 6 Sep 89 11:13:15 GMT
From: GLASSMANN@ccavax.camb.com
Subject: NEWS_RNEWS.COM for other compressed files
Path: ccavax!glassmann
Newsgroups: net.vmsnet
Organization: Cambridge Computer Associates, Inc.
Lines: 75
Apparently-To: drycas.club.cc.cmu.edu!vmsnet

Last week my news feed upgraded to a new version of ULTRIX and a new version of 
news.  When they did that, we started getting compressed news batches that 
didn't start with the string "#! cunbatch".  Because of this, NEWS_RNEWS.COM 
started dropping all of the news on the floor.  Fortunately, there is an 
identifying characteristic in the first 2 bytes (which compress already knows 
how to handle.)  Below is a new version of NEWS_RNEWS.COM, which understands 
this format.



$ !							NEWS_RNEWS.COM
$ SET NOVERIFY
$ GOTO START
$ !
$ !	This command procedure executes in an independent batch process
$ !	usually initiated by UUXQT_DCL.COM which is running as a spawned
$ !	subprocess of UUXQT.EXE .
$ !	
$ !	P1	- the input file spec of a NEWS batch file to be processed
$ !
$ !	Author:	Mark Pizzolato     2/5/89	mark@infopiz.UUCP
$ !	Modified:
$ !		Lenny Glassmann    8/5/89	glassmann@ccavax.camb.com
$ !			Check for compressed files that don't start
$ !			with "#! cunbatch"
$ !	
$
$ START:
$	infile = p1
$	WRITE SYS$OUTPUT "NEWS_RNEWS starting at ''f$time()', infile ''infile'"
$
$	UNCOMPRESS :== $UUCP_BIN:COMPRESS
$	NEWS :== $NEWS_ROOT:NEWS
$	MAGIC = %X9D1F
$	PFLAG = ""
$
$	execqual = ""
$	IF (f$logi("NEWS_EXECUTE_CONTROL")) THEN execqual = "/EXECUTE"
$
$	ON WARNING THEN GOTO NOT_NEWSBATCH
$	OPEN/READ TEMP 'infile'
$	READ/END=NEWS_PROBLEM/ERROR=NEWS_PROBLEM TEMP LINE
$	CLOSE TEMP
$	IF LINE.EQS."#! cunbatch" THEN GOTO DO_COMPRESSED_UNBATCH
$	IF F$CVUI (0, 16, LINE) .EQ. MAGIC THEN GOTO DO_COMPRESSED_BATCH
$	NEWS/NOSCREEN ADD FILE/NETFEED'execqual' 'infile'/DELETE
$	return_status == $status
$	GOTO RETURN_IT
$
$ DO_COMPRESSED_UNBATCH:
$	PFLAG = "p"
$ DO_COMPRESSED_BATCH:
$	batch_file = "NEWS.BATCH"+F$GETJPI("","PID")
$	WRITE SYS$OUTPUT "File is compressed, decompressing."
$	UNCOMPRESS -dzc'pflag' 'infile' >'batch_file'
$	ON WARNING THEN GOTO NEWS_PROBLEM
$	NEWS/NOSCREEN ADD FILE/NETFEED'execqual' 'batch_file'/DELETE
$	DELETE 'infile'
$	return_status == $status
$	GOTO RETURN_IT
$
$ NEWS_PROBLEM:
$	return_status == $status
$	SET NOON
$ 	MAIL NL: usenet/subject="NEWS_RNEWS - trouble inserting Batch File: ''infile'"
$	WRITE SYS$OUTPUT "...''infile' Couldn't be processed by NEWS!"
$	GOTO RETURN_IT
$
$ NOT_NEWSBATCH:
$	return_status == $status
$ 	MAIL NL: usenet/subject="NEWS - Not a News Batch File: ''infile'"
$	WRITE SYS$OUTPUT "...''infile' is not a Compressed News Batch File!"
$
$ RETURN_IT:
$	EXIT 'return_status'
