🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #84219

Re: Mail-to-News

#84219
From: Dennis Davis
Date: Tue, 26 Jul 2011 14:12
137 lines
5963 bytes
In the referenced article, =?windows-1252?Q?Julien_=C9LIE?=
 <iulius@nom-de-mon-site.com.invalid> writes:

...

>> Documentation for inews in INN indicates that it's not suitable
>> for use on client machines.  So these changes won't affect other
>> versions of inews out there.  Eg the inews that comes with the
>> trn Newsreader and the mini-inews that's still out there somewhere.
>
>My comment was only meant for the inews program shipped with
>INN.  It should be updated to take a benefit from the new commands
>defined in RFC 3977.  I do not know much about the other "inews"
>programs in the wild.  I bet it would also be worthwhile updating
>them.

I agree it would be worthwhile, but I'm not sure this would
have much impact.  I suspect all of the "inews" programs in the wild
are used on client machines that have READ/POST permissions.  In
practice any added IHAVE functionality is unlikely to be used.

I also suspect that some of these versions of "inews" aren't
currently maintained.  For example, having mentioned "mini-inews"
I did an Internet search and found a copy.  The datestamps on the
untarred s/w are interesting:

-rw-r--r--  1 ccsdhd  wheel    806 Nov  4  1996 Makefile
-rw-r--r--  1 ccsdhd  wheel   2412 Jul  5  1990 README
-rw-r--r--  1 ccsdhd  wheel  14069 Nov  4  1996 clientlib.c
-rw-r--r--  1 ccsdhd  wheel  11153 Feb  9  1998 conf.h
-rw-r--r--  1 ccsdhd  wheel  11153 Feb  9  1998 conf.h.orig
-rw-r--r--  1 ccsdhd  wheel   9420 Nov  4  1996 inews.c
-rw-r--r--  1 ccsdhd  wheel   3116 Jan 31  1994 nntp.h
-rw-r--r--  1 ccsdhd  wheel   1417 Nov  4  1996 postauth.c
-rw-r--r--  1 ccsdhd  wheel   3508 Nov  4  1996 strcasecmp.c
-rw-r--r--  1 ccsdhd  wheel   2336 Nov  4  1996 uname.c
-rw-r--r--  1 ccsdhd  wheel    234 Nov  4  1996 version.c

This looks to be a standalone inews client stripped out of a release
of nntp, possibly NNTP 1.5.11.  I very much doubt that this s/w is
actively maintained.  But, it still compiles, works and will post
articles to an NNTP server.

...

>> The above shlock perl routine could certainly be made versatile
>> enough for most puposes by adding extra parameters.  Eg
>> "lock_attempts" and "delay" for use in mailpost.
>
>I have come up with a Perl module named INN::Utils::Shlock.
>I hope the naming is fine.
>
>
>Extract from INN::Utils::Shlock(3pm):
>
>NAME
>       INN::Utils::Shlock - Wrapper around the shlock program
>
>DESCRIPTION
>       This Perl module wraps the shlock(1) program so that it can easily be used.  Calling
>       shlock is more portable than using flock(2) and its corresponding Perl function
>       because this function does not work as expected on all existing systems.
>
>       See the shlock(1) documentation for more information.
>
>       Using INN::Utils::Shlock is straight-forward:
>
>           use lib '<pathnews>/lib/perl';
>           use INN::Utils::Shlock;
>
>           my $lockfile = "myprogram.LOCK";
>
>           # Acquire a lock.
>           $INN::Utils::Shlock::lock($lockfile);
>
>           # Unlock.
>           $INN::Utils::Shlock::unlock($lockfile);
>
>       These two functions return 1 on success, 0 on failure.  Therefore, the success of
>       (un)locking can be checked for instance as follows:
>
>           $INN::Utils::Shlock::lock($lockfile) or die "cannot create lock file";
>
>       or:
>
>           if ($INN::Utils::Shlock::lock($lockfile, 4) < 1) {
>               die "giving up after 4 unsuccessful attempts to create lock file";
>           }
>
>INTERFACE
>       lock(lockfile)
>           Tries to create a lock file named lockfile.
>
>       lock(lockfile, retries)
>           Tries to create a lock file named lockfile.  If it fails, locking attempts are
>           repeated once every 2 seconds for at most retries times.
>
>       lock(lockfile, retries, delay)
>           Tries to create a lock file named lockfile.  If it fails, locking attempts are
>           repeated once every delay seconds for at most retries times.
>
>           Note that lock(lockfile) is equivalent to lock(lockfile, 0, 2).
>
>       unlock(lockfile)
>           Removes the file named lockfile.
>
>
>
>
>Do not hesitate to make any comments you think appropriate.
>(In the man page, the variables are properly written in "italics".)
>
>This new Perl wrapper currently works pretty well.

Glad to here it.

I suspect the two lines:

>       These two functions return 1 on success, 0 on failure.  Therefore, the success of
>       (un)locking can be checked for instance as follows:

would read better as:

  These two functions return 1 on success, 0 on failure.  For example
  the success of (un)locking can be checked as:

and I'm sure the perl pedants will want:

>           if ($INN::Utils::Shlock::lock($lockfile, 4) < 1) {

written as:

            if ($INN::Utils::Shlock::lock($lockfile, 4)) {

-- 
Dennis Davis, BUCS, University of Bath, Bath, BA2 7AY, UK
D.H.Davis@bath.ac.uk
Technical Details
Message-ID: <Loy243.Ax8.B.larch@bath.ac.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin1!goblin3!goblin.stu.neva.ru!nntp-feed.chiark.greenend.org.uk!ewrotcd!feeds.news.ox.ac.uk!news.ox.ac.uk!bath.ac.uk!ccsdhd
References: <iuaorh$gbt$1@n102.xanadu-bbs.net> <j01usk$v8r$1@news.trigofacile.com> <LoMMn0.67I.B.larch@bath.ac.uk> <j0cvgt$pok$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <Loy243.Ax8.B.larch@bath.ac.uk>
Subject: Re: Mail-to-News
Date: Tue, 26 Jul 2011 14:12:03 GMT
From: ccsdhd@bath.ac.uk (Dennis Davis)
References: <iuaorh$gbt$1@n102.xanadu-bbs.net> <j01usk$v8r$1@news.trigofacile.com> <LoMMn0.67I.B.larch@bath.ac.uk> <j0cvgt$pok$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin1!goblin3!goblin.stu.neva.ru!nntp-feed.chiark.greenend.org.uk!ewrotcd!feeds.news.ox.ac.uk!news.ox.ac.uk!bath.ac.uk!ccsdhd
Newsgroups: news.software.nntp
Organization: BUCS, University of Bath, UK
Lines: 136