Thread View: news.software.readers
2 messages
2 total messages
Started by Hynek Med
Tue, 08 Mar 1994 11:46
Conversion program news.ini <-> .newsrc ?
Author: Hynek Med
Date: Tue, 08 Mar 1994 11:46
Date: Tue, 08 Mar 1994 11:46
6 lines
964 bytes
964 bytes
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? --
Re: Conversion program news.ini <-> .newsrc ?
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads