Thread View: news.software.readers
2 messages
2 total messages
Started by Hallvard Tangeraas
Sat, 14 Dec 1996 00:00
Re: Need help setting up a news-filter ('trnkill'?)
Author: Hallvard Tangeraas
Date: Sat, 14 Dec 1996 00:00
Date: Sat, 14 Dec 1996 00:00
52 lines
2373 bytes
2373 bytes
I really didn't understand much of that explanation about the 'trnkill'
script, but I did a little check on my system and found an error...
That is, using "trace" I found out that the path which the script is
calling is incorrect with my UNIX setup:
-----------------------------------
brk (0x1c090) = 0
brk (0x1c490) = 0
access ("/local/gnu/bin/trn", 01) = -1 ENOENT (No such file or directory)
access ("/local/bin/trn", 01) = 0
stat ("/local/bin/trn", 0xeffff628) = 0
fork () = 29364
sigblock (0) = 0
sigstack (0, 0xeffff8fc) = 0
wait4 (0, 0xeffff97c, 0, 0) = 0
- SIGCHLD (20)
wait4 (0, 0xeffff97c, 0, 0) = 29364
sigblock (0) = 0
sigstack (0, 0xeffff78c) = 0
read (19, " $TRNMACRO\nexit 0\n\n", 128) = 19
access ("/local/gnu/bin/rm", 01) = 0
stat ("/local/gnu/bin/rm", 0xeffff808) = 0
--------------------------------
This however is where it's located:
---------------------------
sinsen.sn.no 25% which trn
/local/bin/trn
sinsen.sn.no 26%
---------------------------
So, step by step, what should I exactly do in order to make the script work
in order to filter out those postings I don't want?
And.... I don't use TRN, but TIN. I've barely tried TRN, and if I can avoid
learning another totally new program to me just in order to do this
filtering thing I'd be most grateful.
I'm pretty comfortable with TIN, although I get my news/mail as offline
SOUP packets.
Hallvard
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Greetings from Norway! -Land of the fjords and midnight sun
* * * * * * * * * * * * * * * * * * * * * * * * *
URL hyperlink-launchpad: <http://home.sn.no/~hallvart/>
Re: Need help setting up a news-filter ('trnkill'?)
Author: Kevin Martin
Date: Mon, 16 Dec 1996 00:00
Date: Mon, 16 Dec 1996 00:00
111 lines
4918 bytes
4918 bytes
In article <32b30f3a20bb286@sn.no>,
hallvart@sn.no (Hallvard Tangeraas) wrote:
>I really didn't understand much of that explanation about the 'trnkill'
>script, but I did a little check on my system and found an error...
>
>That is, using "trace" I found out that the path which the script is
>calling is incorrect with my UNIX setup:
That shouldn't matter, as long as trn (lowercase, please!) starts
when you type "trn" at the command prompt. If typing "trn" doesn't
start trn, then you have to fix your $PATH so that it includes the
true location of trn.
Okay, let's beat this thing once and for all. Here's the entire
script, and my (non-executable) comments are indented:
#!/bin/sh
This means that it's a shell script, which will run in the
context of "sh", the Bourne shell, regardless of what shell
you use by default. The next few lines are comments...
# trnkill - shell script to apply trn KILL files in the background
# 14 Mar 89 created for rn by Jim Olsen <olsen@XN.LL.MIT.EDU>
# 10 Sep 93 modified for trn 3 (or 2) by Wayne Davison
# <davison@borland.com>
# 16 Nov 94 complete rewrite; via e-mail from Chin Huang
# <cthuang@io.sys>
#
# Options: -d debug mode -- you see all gory action as it happens.
#
This next comment explains EXACTLY what the script does:
# Visit all newsgroups (if trn asks about anything else, just say no)
Now it's going to create some "symbols" and write a few lines
out to your /tmp directory, using your process ID to give the
resulting temporary file a unique name:
export TRNINIT TRNMACRO RNMACRO
TRNINIT='-q -s -T -t -x +X'
TRNMACRO=/tmp/trnkill$$
# support for trn 2.x
RNMACRO=$TRNMACRO
It's going to exit and remove the temporary file on any of
a number of possible conditions....
trap 'rm -f $TRNMACRO; exit' 1 2 3 15
Here is where it creates the three-line temporary file:
cat >$TRNMACRO <<'EOF'
z %(%m=[nf]?.q^J:n)^(z^)
^m ^(z^)
^j ^(z^)
EOF
These three lines say (in trn talk) "run some trn commands
when the user presses the 'z' key." That's what a macro is,
just some pre-recorded commands. All THESE trn commands do
is open the next subscribed group and then 'q'uit. Repeat
until you run out of groups, at which point the run ends.
The heart of the matter is the line "echo 'z' | trn" which
runs trn AND SENDS IT THE 'z' KEY. Note that the script
does not specify that directory you had in your trace --
so if you've diddled with the script to include your home
directory or something, put it back the way it was:
if test X$1 = X-d; then
echo "z" | trn
else
echo "z" | trn >/dev/null 2>&1
fi
Clean up by deleting the temporary file, and we're done:
rm -f $TRNMACRO
exit 0
That's all there is to it. The "magic" is entirely a question
of what trn KILL files you have created. If you don't have any,
then running the above will not do anything. If you do, they
will be applied (the global KILL file will apply to all the
groups you read, and the group-specific ones will apply to the
appropriate group).
>And.... I don't use TRN, but TIN. I've barely tried TRN, and if I can
>avoid learning another totally new program to me just in order to do
>this filtering thing I'd be most grateful.
Sorry, tin doesn't know anything about trn's macro language or KILL
files. You HAVE to use trn to do this.
I've run tin a couple of times when trn blew up on an invalid article,
and they seem to be honoring the same .newsrc file (for the benefit of
lurkers with even less experience than you, the .newsrc file lists the
groups to which you subscribe and the article-numbers you've already
seen; it's how a newsreader knows not to show you the same stuff twice).
So if you run trnkill it should clean up things for tin -- and for uqwk.
But you HAVE to create the KILL files using trn's syntax in order for
this to work. Make up your mind to put in a bit of effort, and we'll be
happy to help you as much as we can. You have to hold up your end of
the load, though. You don't have to be a trn wizard to write a few
simple KILL files. Just read the FAQ's that have already been pointed
out. The time you invest doing this will be repaid very quickly.
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