Article View: demon.ip.developers
Article #726Re: Killfile question !
From: Graham E Kinns
Date: Sun, 03 Nov 1996 00:00
Date: Sun, 03 Nov 1996 00:00
61 lines
2743 bytes
2743 bytes
Nick Leverton <leveret@warren.demon.co.uk> wrote:
>I put a line in my NNTP killfile as follows:
> Subject: *[ _-]LOOT[ _-]*rail*
>wanting to catch "lootrail", "loot-rail", "loot_rail" and "loot rail"
>and similar combinations (if you read misc.transport.urban-transit
>you'll understand).
>
>But it also catches a whole lot more.
>The line in wildmat.c, case '[', that says
>
> if(*p == '-' ? *s <= *++p && *s >= last : *s == *p)
> matched = TRUE;
>
>is the one in error.
Diff below stolen from a later version of wildmat(3) that accompanies
INN 1.4. Overhead around 44 bytes - trivial compared to the amount
saved by fixing smtp list, tzset, resolve_mx, news client .....
man 3 wildmat says:
[x...y]
Matches any single character specified by the set x...y. A minus
sign may be used to indicate a range of characters. That is,
[0-5abc] is a shorthand for [012345abc]. More than one range may
appear inside a character set; [0-9a-zA-Z._] matches almost all of
the legal characters for a host name. The close bracket, ], may be
used if it is the first character in the set. The minus sign, -,
may be used if it is either the first or last character in the set.
[^x...y]
This matches any character not in the set x...y, which is
interpreted as described above. For example, [^]-] matches any
any character other than a close bracket or minus sign.
--- src/wildmat.c Fri Jul 16 11:52:24 1993
+++ src_exp/wildmat.c Sun Nov 3 14:37:58 1996
@@ -114,9 +114,13 @@
reverse = (p[1] == '^') ? TRUE : FALSE;
if(reverse)
p++;
- for(last = 0400, matched = FALSE; *++p && *p != ']'; last = *p){
+ matched = FALSE;
+ if (p[1] == ']' || p[1] == '-')
+ if (*++p == *s)
+ matched = TRUE;
+ for (last = *p; *++p && *p != ']'; last = *p) {
/* This next line requires a good C compiler. */
- if(*p == '-' ? *s <= *++p && *s >= last : *s == *p)
+ if (*p == '-' && p[1] != ']' ? *s <= *++p && *s >= last : *s == *p)
matched = TRUE;
}
if(matched == reverse)
Cheers, Graham.
--
----[ Graham E. Kinns ]----==========----< Graham@grempc.demon.co.uk >----
Technical Details
Message-ID:
<847043628snz.5914@grempc.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<846896475snx@warren.demon.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10bb05,fdf8ccd8b84c85b1 X-Google-Attributes: gid10bb05,public From: Graham@grempc.demon.co.uk (Graham E Kinns) Subject: Re: Killfile question ! Date: 1996/11/03 Message-ID: <847043628snz.5914@grempc.demon.co.uk> X-Deja-AN: 194183242 x-mail2news-path: grempc.demon.co.uk references: <846896475snx@warren.demon.co.uk> x-mail2news-user: Graham@grempc.demon.co.uk organization: Home, N Yorks, UK newsgroups: demon.ip.developers