Thread View: news.software.readers
2 messages
2 total messages
Started by Olly Betts
Mon, 13 Mar 1995 17:26
TRN macros
Author: Olly Betts
Date: Mon, 13 Mar 1995 17:26
Date: Mon, 13 Mar 1995 17:26
41 lines
1999 bytes
1999 bytes
I'm using strn, though this is a trn question (I think). v at the newsgroups prompt gives: STRN version 0.9.2 (beta) This source is based on: @(#)$Id: trn.c,v 3.0 1991/11/22 00:14:59 davison Trn $ Version: 0.9.2/3.4.1 Send bug reports to caadams@access.digex.net OK, here's the problem. The default (according to the man page) for NEWSHEADER is: %(%[followup-to]=^$?:X-ORIGINAL-NEWSGROUPS: %n )Newsgroups: %(%F=^$?%C:%F) [...] I assume the X-ORIGINAL-NEWSGROUPS is a "your follow-up is being redirected somewhere" warning. That's what I use it for anyway, and it gets stripped out before posting. However, it only catches an empty or non-existant Followup-To:. There are a number of posts around which have a Followup-To: with the same groups as the Newsgroups: line. IMHO this is brain-dead, but life is full of brain-dead news software, so I want to catch this case too. I've tried: %(%[followup-to]=^$?:%(%[followup-to]=^%n$?:X-ORIGINAL-NEWSGROUPS: %n )) but this doesn't work. Investigation reveals that: %(%%n=^%n$?True:False) gives True. So it seems % expansion isn't done on the reg-exp pattern. Is this a bug, or the intended behaviour? And is there a way around this? Olly -- Putting the "Ol" in technology.
Re: TRN macros
Author: Wayne Davison
Date: Fri, 17 Mar 1995 20:57
Date: Fri, 17 Mar 1995 20:57
60 lines
2605 bytes
2605 bytes
According to Olly Betts <olly@mantis.co.uk>:
> I assume the X-ORIGINAL-NEWSGROUPS is a "your follow-up is being redirected
> somewhere" warning.
Yup, that's it's purpose.
> However, it only catches an empty or non-existant Followup-To:. There are a
> number of posts around which have a Followup-To: with the same groups as the
> Newsgroups: line.
You need trn 3.6 for your macro to work (which has an identical macro for
the default for the X-ORIGINAL-NEWSGROUPS as the one you suggested). The
problem is, as you surmised, the comparison:
%(%[followup-to]=^%n$?
will never succeed in older s/t/rn's because the regex portion of the '='
comparison would never expand '%'s -- it is comparing to the literal string
"%n". Trn 3.6 enhanced the equality operator to allow this to work.
Since you are using strn, you'll either have to manually apply a patch
or wait for the trn fixes to arrive in strn form. I'm working on a
unification of strn and trn's latest enhancements that will arrive at
some point as trn 4.0, but that won't be for a while yet.
I believe the relevant change from trn 3.6 to fix this problem is
this hunk of code, which abuses a few local variables in the process
but gets the job done:
Index:intrp.c
@@ -568,4 +574,26 @@
if (!*pattern)
goto getout;
+ s = scrbuf;
+ h = spfbuf;
+ proc_sprintf = FALSE;
+ do {
+ switch (*s) {
+ case '^':
+ *h++ = '\\';
+ break;
+ case '\\':
+ *h++ = '\\';
+ *h++ = '\\';
+ break;
+ case '%':
+ proc_sprintf = TRUE;
+ break;
+ }
+ *h++ = *s;
+ } while (*s++);
+ if (proc_sprintf) {
+ dointerp(scrbuf,sizeof scrbuf,spfbuf,Nullch);
+ proc_sprintf = FALSE;
+ }
if (s = compile(&cond_compex,scrbuf,TRUE,TRUE)) {
printf("%s: %s\n",scrbuf,s) FLUSH;
--
Wayne Davison
wayne@trn.com
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