[uw.unix] Catching up on News

cgwong@watdragon.waterloo.edu (Clint Wong) (09/12/89)

Is there a quick way in rn to mark all unread articles as being read?
-- 
UUCP      : {uunet,utai,clyde}!watmath!cgwong
INTERNET  : cgwong@watmath.waterloo.edu            <  Clint Wong  >
BITNET    : cgwong@water.BITNET                    <  University of Waterloo  >

dgharriss@watmsg.waterloo.edu (Dermot G. Harriss) (09/12/89)

In article <16326@watdragon.waterloo.edu> cgwong@watdragon.waterloo.edu (Clint Wong) writes:
>Is there a quick way in rn to mark all unread articles as being read?

Sure.  Your subject line suggests a likely possibility.
The command is "c" which stands for "catch up".
You can use it either at the news group selection level or the
article selection level.
It's in the manual.

	c    Catch up--mark all unread articles in this newsgroup as
	     read.

Cheers.

cgwong@watdragon.waterloo.edu (Clint Wong) (09/12/89)

In article <29052@watmath.waterloo.edu>, dgharriss@watmsg.waterloo.edu (Dermot G. Harriss) writes:
> In article <16326@watdragon.waterloo.edu> cgwong@watdragon.waterloo.edu (Clint Wong) writes:
> >Is there a quick way in rn to mark all unread articles as being read?
> 
> Sure.  Your subject line suggests a likely possibility.
> The command is "c" which stands for "catch up".
> You can use it either at the news group selection level or the
> article selection level.
> It's in the manual.
> 
> 	c    Catch up--mark all unread articles in this newsgroup as
> 	     read.
> 
> Cheers.

This is not quite what I was looking for.  I want to catch-up on ALL of
my currently subscribed newsgroups all at once.  This is useful when trying
to move your .newsrc to another machine and all the article numbers are
different or when you come back from a long vacation and there are a zillion
Unread articles in a hundred groups.
-- 
UUCP      : {uunet,utai,clyde}!watmath!cgwong
INTERNET  : cgwong@watmath.waterloo.edu            <  Clint Wong  >
BITNET    : cgwong@water.BITNET                    <  University of Waterloo  >

dgharriss@watmath.waterloo.edu (Dermot G. Harriss) (09/13/89)

In article <16340@watdragon.waterloo.edu> cgwong@watdragon.waterloo.edu (Clint Wong) writes:
>> >Is there a quick way in rn to mark all unread articles as being read?
>> 
>This is not quite what I was looking for.  I want to catch-up on ALL of
>my currently subscribed newsgroups all at once.  This is useful when trying
>to move your .newsrc to another machine and all the article numbers are
>different or when you come back from a long vacation and there are a zillion
>Unread articles in a hundred groups.

In rn?  As a guess, no.  "c" when the current group is $ at the newsgroup
selection level doesn't have the intuitive effect of catching up all
groups.  You'd have to write a macro or something.  Steve? ;-)

But you can achieve the same effect by munging your .newsrc to set the 
last read article numbers to the server's last received article numbers 
as recorder in the news active file.  Here's an awk (actually new awk)
tool I just whipped up to do this:

BEGIN {
	FS = "[ \t]+"
}
{
	entry = $1
	group = substr (entry, 1, length (entry)-1)
	while (getline < "active" > 0) {
		if ($1 == group) {
			printf ("%s 1-%d\n", entry, $2)
			break
		}
	}
	close "active"
}

1. put the above script in the directory where your .newsrc is
   (let's call it "doit").
2. use getactive(8) to get your server's active file: type
	getactive active
   in the same directory where .newsrc and doit are.
3. save your old .newsrc:
	mv .newsrc .newsrc~
3. type the following:
	nawk -f doit < .newsrc~ > .newsrc
   This will take a while if your .newsrc contains many groups or your
   machine is slow (or both).  You can "tail -f .newsrc" if you like to
   see how (or if) things are progressing.

The above script is very inefficient.  The active file (which is huge)
is opened and read for every line of your .newsrc file.  If your .newsrc
file happened to be alphabetically sorted by group name, then you could
eliminate the `close "active"' line, making it considerably faster.
It's a 3 minute hack - I don't claim it's beautiful or robust or anything.

UW.UNIX STEVE HAYMAN MEMORIAL AWK HACKERS CHALLANGE!!!

	make it faster!  make it beautiful!
	hint: check out awk arrays...

enjoy.
							-- Dermot


P.S.
As for moving your .newsrc to a machine served by a different news server,
see fix_newsrc(8).

brad@looking.on.ca (Brad Templeton) (09/13/89)

Actually, you might want to check out our "mknewsrc" program.  It's in
my newsclip directory (~bstempleton/clip) on watmath.  It will create
a .newsrc for you that has every current article unread, but it has a
"p=" option to specify a percentage.

	mknewsrc +n p=100
		- outputs a .newsrc with the same groups as your .newsrc
		  with 100% of articles unread
	mknewsrc +n p=0
		- does what you want, with all article marked read
	mknewsrc +n p=10
		- gives you the last 10% of articles in each group

	Skip the +n and it gives you all groups in the active file.
	Provide patterns and you will only get groups that match the
	regular expressions.

output is to stdout.  Wiht +n it's probably not safe to write to your
.newsrc directly.
-- 
Brad Templeton, Looking Glass Software Ltd.  --  Waterloo, Ontario 519/884-7473

jdchrist@watcgl.waterloo.edu (Dan Christensen) (09/13/89)

In article <16326@watdragon.waterloo.edu> cgwong@watdragon.waterloo.edu (Clint Wong) writes:
>Is there a quick way in rn to mark all unread articles as being read?
>-- 
>UUCP      : {uunet,utai,clyde}!watmath!cgwong
>INTERNET  : cgwong@watmath.waterloo.edu            <  Clint Wong  >
>BITNET    : cgwong@water.BITNET                    <  University of Waterloo  >

The "c" command does it.  In rn, "h" gives you context sensitive help
and shows the "c" command.

----
Dan Christensen, Computer Graphics Lab,	         jdchrist@watcgl.uwaterloo.ca
University of Waterloo, Waterloo, Ont.	         jdchrist@watcgl.waterloo.edu

sahayman@iuvax.cs.indiana.edu (09/14/89)

From: Steve Hayman <sahayman@iuvax.cs.indiana.edu>


If you typed "space" enough times while reading rn, you'd read all the
articles and eventually quit (when you hit the **** End--next? [qnp] prompt).
So, one thing you could do is arrange to output a continuous stream
of spaces and pipe this into rn:

    %  yes ' ' | rn >/dev/null

except at MFCF for historical reasons, the "yes" command has been
renamed "adnauseam" (hey guys, with all this pathname reorganization,
isn't it  about time to restore the original "/usr/ucb/yes" command.)

Actually I'd probably write a little awk script to load up the active
file into an awk associative array, and then filter the .newsrc
appropriately, as suggested by dermot's challenge.  but I guess I can't
enter :-)  Shouldn't take any more than, oh ...

    % decomment ~/bin/catchup | wc
      9     21    184


... nine lines or so. 

Steve

rbutterworth@watmath.waterloo.edu (Ray Butterworth) (09/14/89)

In article <29132@watmath.waterloo.edu>, sahayman@iuvax.cs.indiana.edu writes:
> ... 
> except at MFCF for historical reasons, the "yes" command has been
> renamed "adnauseam" (hey guys, with all this pathname reorganization,
> isn't it  about time to restore the original "/usr/ucb/yes" command.)

Don't forget what those historical reasons were.
People running interactive programs that prompt for yes or no answers
will often use type-ahead when the system is slow and they know what
the next question is going to be.  Any mistake in this can leave a
"yes" waiting to execute, and when it does an infinite stream of "y"s,
one per line, is printed.  This is really fun on a hard-copy console
when the operator returns a few minutes later and has to replace
the box of paper that was just chewed up.

Perhaps a better change would have been to make "yes"
not work if output is to a tty?