Article View: news.software.readers
Article #7968Re: Conversion program news.ini <-> .newsrc ?
From: Gareth Owen
Date: Tue, 08 Mar 1994 16:39
Date: Tue, 08 Mar 1994 16:39
70 lines
2770 bytes
2770 bytes
Hynek Med (xmedh02@vse.cz) wrote:
: Hi,
: sorry this is rather faq-ish, but I couldn't find the faq.. Is there a
: program, that converts the news.ini file (MS-DOS Trumpet) to Unix .newsrc
: and vice versa?
: --
Here are a couple of simple perl scripts.
The first , trumpet->.newrc is straight forward.
The second will work on a novell network where the user's news.ini
file is in the mail directory providing the environment variable 'NWHAT'
is set by running 'NWHAT -id' beforehand.
Otherwise both create their files in the current directory.
Gareth
------------------------------cut here----------------------------------
#!/usr/local/bin/perl
# Convert trumpet news.ini into .newsrc
# G.O. 26-08-93
open(TRUMPET,'news.ini')|| die "Can't open news.ini";
$status=rename(".newsrc",".newsrc.old");
open(NEWSRC,">.newsrc")||die "Can't write to .newsrc";
while (<TRUMPET>) {
if (/^([^\s]+)\s+([YN])\s+([\d\s\-]*)/) {
if ($2 eq 'Y') { $sub=':';}
else { $sub='!'}
($read=$3) =~ tr/\s/,/;
print NEWSRC "$1$sub $read";
}
}
close(NEWSRC);
close(TRUMPET);
---------------------------------and here---------------------------------
# Convert unix .newsrc file into form used by trumpet
# G.O. 26-08-93
$back="\x08"x(10);
if ( $ENV{'NWHAT'} eq '' ) { $path='.';}
else { $path="Z:\\MAIL\\".$ENV{'NWHAT'}; }
print "$path\n";
open(NEWSRC,'newsrc')|| die "Can't open file 'newsrc'";
rename("$path/NEWS.INI","$path/NEWS.OLD");
open(NEWSINI,">$path/NEWS.INI");
while (<NEWSRC>) {
if (/^([\w.]+)([:!])\s*([\d,\-]*)$/) {
if ( $2 eq ':' ) {
print NEWSINI "$1 Y";
if ( $3 ) {
($read=$3) =~ tr/,/ /;
print NEWSINI " $read";
}
print NEWSINI "\n";
}
}
print $.,$back;
}
close(NEWSRC);
close(NEWSINI);
--
---------------
Gareth Owen ,Information Systems ,Aston University , Birmingham , UK
Technical Details
Message-ID:
<CMCu9G.M5u@aston.ac.uk>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!newsserver.jvnc.net!netnews.upenn.edu!msuinfo!uwm.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!pipex!warwick!sunserver1.aston.ac.uk!caledfwlch.aston.ac.uk!owengReferences:
<1994Mar8.114648.19377@vse.cz>Show Full Headers
Complete Article Headers
Message-ID: <CMCu9G.M5u@aston.ac.uk> Subject: Re: Conversion program news.ini <-> .newsrc ? Date: Tue, 8 Mar 1994 16:39:16 GMT From: oweng@aston.ac.uk (Gareth Owen) References: <1994Mar8.114648.19377@vse.cz> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!newsserver.jvnc.net!netnews.upenn.edu!msuinfo!uwm.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!pipex!warwick!sunserver1.aston.ac.uk!caledfwlch.aston.ac.uk!oweng Newsgroups: news.software.readers Sender: usenet@aston.ac.uk Organization: Aston University X-Newsreader: TIN [version 1.2 PL2] Lines: 70