🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #7735

Re: Manually updating .newsrc (rn/trn)

#7735
From: David Charlap
Date: Thu, 17 Feb 1994 00:02
33 lines
2360 bytes
Peter Johansson <peter@cs.umbc.edu> wrote:
>
>However, I am in the process of writing a program to automatically
>"read" articles and then mark them as read.  What I would like to do
>is read in my .newsrc, munge it as necessary, and then write it out.

Look at the "getactive" program.  (It's wherever trn's lib directory
is).  This program will get status information about all active
newsgroups and write it to a file.  You can then parse this as you
wish.  I think the newsetup program uses just this method to create
your initial .newsrc file.

>Is there anything I should be aware of?  Obviously, I will want some
>kind of locking to make sure I don't have two processes updating my
>.newsrc at the same time.

rn and trn use the file ~/.rnlock to handle this.  If the file exists,
then some news-reading process is active.  The file contains the pid
of the process that has locked the news files.  You should check to
see if this process is still running, and if it is get out.  If the
process isn't running, then you should issue a warning and then trash
the lock file.

At least that's what seems to be a good idea to do.  I don't know what
trn actually does.  If your system can implement hard (not advisory)
file locks, then it might just be easier to lock the file and do what
you want to it.  You won't be able to get a hard lock if some other
process has it open.
-- 
+----------------------+------------------------------------------------------+
| David Charlap        | The contents of this message are not the opinions of |
| Visix Software, Inc. | Visix Software, or of anyone besides myself.         |
| david@visix.com      +------------------------------------------------------+
Technical Details
Message-ID: <CLCDGo.1t0@visix.com>
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!howland.reston.ans.net!cs.utexas.edu!uunet!psinntp!viper!david
References: <2jjqu4INN90c@topdog.cs.umbc.edu>

Show Full Headers
Complete Article Headers
Message-ID: <CLCDGo.1t0@visix.com>
Subject: Re: Manually updating .newsrc (rn/trn)
Date: Thu, 17 Feb 1994 00:02:47 GMT
From: david@visix.com (David Charlap)
References: <2jjqu4INN90c@topdog.cs.umbc.edu>
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!howland.reston.ans.net!cs.utexas.edu!uunet!psinntp!viper!david
Newsgroups: news.software.readers
Organization: Visix Software, Inc., Reston, VA
Lines: 33