Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!samsung!usc!apple!mips!prls!pyramid!wjvax!mario From: mario@wjvax.UUCP (Mario Dona) Newsgroups: comp.binaries.ibm.pc.d Subject: c.b.i.p news grabber Message-ID: <1612@wjvax.UUCP> Date: 9 Nov 89 18:28:27 GMT Organization: Watkins-Johnson Co., San Jose Lines: 137 In article you write: > >Does anyone have, or know of, any MS-DOS programs for reading UNIX >news and/or mail? If not, it might be a good programming project for >myself or anyone else out there. >-- This may not be exactly what your asking for, but it does give me an opportunity to submit what I consider a wonderful script for automating the checking/saving/uudecoding of single and multiple-part binaries. It does everything but transfer it to your PC. This script was written by Andre van Dalen of the Netherlands. It's very simple to setup and use. This script makes use of the following directories: ~/News/ibm ~/News/ibm/old ~/tmp but these can be changed to whatever you prefer. The pibm script is meant to be used in ~/News, but it can also be somewhere in your PATH. What it does is: checks the posting with brik, if it is a one-part posting -> uudecode into ~/News/ibm else save as ~/News/ibm/. if all parts received -> uudecode into ~/News/ibm; mv parts to ~/News/ibm/old To unpack multi-part postings, it uses the combine script which is also included. BTY, I did modify Andre's script just a little. I added a line that saves the header information (down to the encoded stuff) in addition to the archive file. It's saved under the same name as the archive but with a .hdr extention. To use the script, do the following: 1. Save the combine and pibm scripts separately in ~/bin (or whereever you put your executables). 2. Use chmod to make them executable. 3. Create the ~/News, ~/News/ibm, and ~/News/ibm/old directories as needed. 4. Start rn; when you get to c.b.i.p, type .-$|pibm at the first posting. After pibm has finished doing its thing, it will return to the first posting where you can hit c(atch up) to tag all articles as read, if you wish. -----cut here ----- : # $(#) pibm -- save c.b.i.p. articles -- Andre van Dalen, andre@targon # Save postings from comp.binaries.ibm.pc # tmp=/tmp/pibm$$ cat - > $tmp if brik -cv < $tmp then echo Checksum OK.. else echo Checksum NOT OK!!! File not saved! exit 1 fi #subject=`grep '^Subject:' $tmp` #part=`echo $subject | sed -n 's:^.*[Pp]art \([0-9][0-9]*\)/.*$:\1:p'` #last=`echo $subject | sed -n 's:^.*[Pp]art [0-9][0-9]*/\([0-9][0-9]*\).*$:\1:p'` #name=`echo $subject | sed 's/Subject: v[^:]*: \([^, ]*\)[, ].*/\1/'` archnam=`grep '^Archive-name:' $tmp` subject=`grep '^Subject:' $tmp` part=`echo $subject | sed -n 's:^.*[Pp]art *\([0-9][0-9]*\)/.*$:\1:p'` last=`echo $subject | sed -n 's:^.*[Pp]art *[0-9][0-9]*/\([0-9][0-9]*\).*$:\1:p'` name=`echo $archnam | sed -e 's/Archive-name: \([^, ]*\).*/\1/' \ -e 's:/[Pp]art[0-9][0-9]*::' | tr '/' '_' ` txtname=`echo $archnam | sed -e 's/Archive-name: //' -e 's/\(\/\).*$//'` save=ibm/$name.$part lastsave=ibm/$name.$last #echo name $name part $part last $last save $save lastsave $lastsave #exit if [ "$part" = "" ] then echo One part posting, uudecoding... cd ibm cat $tmp | sed '/^BEGIN/,$d' > $txtname.hdr uudecode < $tmp else echo Multi part posting, saving as $save if [ -f $save ] then echo $save already exists! not saved. else cp $tmp $save nr=`ls ibm/$name.[0-9][0-9] | wc -l` echo Now we have $nr out of $last parts if [ -f $lastsave -a $nr -eq $last ] then echo Last part, try to combine... cd ibm cat $name.01 | sed '/^BEGIN/,$d' > $txtname.hdr combine $name echo mv $name.[0-9][0-9] old mv $name.[0-9][0-9] old fi fi fi rm $tmp ---- cut here ---- # @(#) combine - put c.b.i.p postings together. for i in $* do list=`echo " " $i.* " " | sed 's/ [^ ]*[^0-9 ] / /g'` echo "$list -> " \\c brik -cv $list cat $list | sed '/^END--/,/^BEGIN--/d' | uudecode echo $i*.[aze]* done ---- end ---- All credit goes to Andre van Dalen for coming up with this script which has been a real time saver for me. Have fun, Mario ======================================================================== Mario Dona ...!{ !decwrl!qubix, ames!oliveb!tymix, pyramid}!wjvax!mario The above opinions are mine alone and not, in any way, those of WJ.