mario@wjvax.UUCP (Mario Dona) (11/10/89)
In article <Oct.28.18.40.14.1989.705@caip.rutgers.edu> 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/<name>.<nr> 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.
cmaidt@metnet.FIDONET.ORG (Chris Maidt) (11/12/89)
In an article of <9 Nov 89 18:28:27 GMT>, mario@wjvax.UUCP (Mario Dona) writes: > >In article <Oct.28.18.40.14.1989.705@caip.rutgers.edu> 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. > > ... > >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. > Please excuse my ignorance, but what programs are availible to run this script on my PC, (under MS-DOS)? I am the postmmaster of our local fidonet<->usenet gateway, and as such I port ALL mail/newsgroups to MS-DOS. I would dearly *LOVE* to be able to run your script ... but I no not of the existance of the utilities necessary to do so. I have a very poor imitation of SED, (hardly works at all like the real thing), I have AWK, I have most of the smaller/handier commands (head/tail/cat/ls/chmod/etc) -- what else do I need bar UNIX itself? . . . . . . . . . . . . . . . . . . . . . . . . . . . cmaidt%metnet@uokmax.uucp . . . postmaster@metnet.fidonet.org . . . ...!apple!uokmax!metnet!cmaidt . . . postmaster%metnet@uokmax.ecn.uoknor.edu . . . cmaidt%f9.n147.z1.fidonet.org@uokmax.uucp . . . FidoNets 1:147/9.0, 1:147/10.0 & 1:147/30.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Wayback Machine - N/8/1 - (405)848-2005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . -- Chris Maidt - via FidoNet node 1:147/10 UUCP: ...!att!occrsh!uokmax!metnet!cmaidt INTERNET: cmaidt@metnet.FIDONET.ORG