🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #255492

Re: [slrn] Solution to the age-old question

#255492
From: ernobe
Date: Sat, 14 Sep 2013 14:29
86 lines
4326 bytes
>
> I just realized that the -t option of the Linux list command arranges the 
> articles by newest first.  Will have to modify the program of my latest post 
> accordingly, though it works as advertized if you remove the -t option from 
> the source code ( and your server provides the articles in numerical order ).
>
>

The -t option to the Linux ls command lists the articles by newest first, as 
in 'ls -lt'.  But if they have been placed in the directory quicker than about 
a second apart, they are listed by name.  So the following program examines 
the date by day, hour, and minute.  The articles names are irrelevant ( they 
only must be numerical ), and the configuration file keeps a record of the 
time the last article was downloaded.  When the program reaches an article 
with that date, it stops processing that newsgroup.  If for some reason you 
only want to update some of the groups, do nothing to the configuration file, 
just don't use slrnpull to download any new articles from that group.  To 
initialize a new group, add its full path ending with a slash to the 
configuration file ( after downloading articles from it ).

I think it would be a good idea to have it report if it didn't find a 
message-id in an article.  Just to keep tabs on the servers' behaviour.  
Anyway, I'll leave it on the wishlist for now.

procedure main()
no := po := 0
q := open( "/home/roy/.slrn-stickytags", "crw" ) | stop( "unable to create slrn-stickytags" )
g := open( "/home/roy/News/spool/newupd.conf" ) | stop( "no slrnpull conf file" )
m := open( "/home/roy/News/spool/newupdi.conf", "crw" ) | stop( "unable to create newupdi.conf" )
u := open( "/home/roy/News/spool/scoring", "crw" ) | stop( "unable to create scoring" )
write( u, "[*]\nScore:: 1" )
while a := read( g ) do
    { a ? 
	{ y := tab( upto( ' ' ) | 0 ) 
        move( 1 )
        i := tab( 0 )
        }
    if *trim( y ) = 0 then break
    ( z := numeric( i )) | write( "initializing ", y, "..." )
    n := open( "ls -lt --time-style=+:%j%H%M " || y, "p" ) | stop( "unable to list ", y )
    while p := read( n ) do 
	{ p ? 
	    { &pos := (( upto( ':' ) + 1 ) | next )
		kk := move( 7 )
		move( 1 )
		k := ( numeric( tab( 0 )) | next )
	    }
	no +:= 1
	if no = 1 then nn := kk      
	if /z | ( kk = z ) then  
	    break 
	else 
	    { j := open( y || k ) | stop( "unable to open ", y || k )
	    while b := read( j ) do
		{ if b[1:7] == "Messag" then 
		    { write( q, b[13:0] )
		    write( u, b ) 
		    break
		    }
		}
	    close( j )
	    }
	}
    close( n )
    ( no > 0 ) | { write( "you must run slrnpull with ", y, " in slrnpull.conf" )
	write( m, y )
	next
	}
    write( m, y, " ", nn )
    write( "finished     ", y )
    po +:= no - 1
    no := 0
    }
close( m )
close( g )
system( "mv /home/roy/News/spool/newupdi.conf /home/roy/News/spool/newupd.conf" )
write( "added ", po, " new posts" )
end


		    
-- 
"The world of existence is an emanation of the merciful attribute of God."
Abdu'l-Baha
http://www.costarricense.cr/pagina/ernobe
Technical Details
Message-ID: <l11rrr$aqa$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.bbs-scene.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
References: <kvj8oe$f5$1@dont-email.me> <l0d15f$n9n$1@dont-email.me> <l0tc1t$cn2$1@dont-email.me>

Show Full Headers
Complete Article Headers
Message-ID: <l11rrr$aqa$1@dont-email.me>
Subject: Re: [slrn] Solution to the age-old question
Date: Sat, 14 Sep 2013 14:29:15 +0000
From: ernobe <ernobe@yahoo.com>
References: <kvj8oe$f5$1@dont-email.me> <l0d15f$n9n$1@dont-email.me> <l0tc1t$cn2$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.bbs-scene.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
Newsgroups: news.software.readers
Organization: World Order of Baha'u'llah
Lines: 86
Injection-Date: Sat, 14 Sep 2013 14:29:15 +0000 (UTC)
Injection-Info: mx05.eternal-september.org;
 posting-host="aa62c9dfd94aa8dd21cd89a27766d80d";
 logging-data="11082"; mail-complaints-to="abuse@eternal-september.org";
 posting-account="U2FsdGVkX1+bNyGyzAOI0hxJ1hhFCbLr"
User-Agent: slrn/pre1.0.0-18 (Linux)
Cancel-Lock: sha1:3uhDH9LKj6WcU72eesgdUYzy8dM=
X-Original-Bytes: 4071