🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.b
Article #7045

Re: Newsgroup hierarchy and sys file confusion

#7045
From: Mark Nagel
Date: Fri, 02 Mar 1990 19:11
46 lines
1887 bytes
flee@shire.cs.psu.edu (Felix Lee) writes:

>>...,alt.sex,!alt.sex.all,alt.sex.bondage,...

>I wrote an &ngmatch function in perl that handles this "correctly".
>It uses the best match, where "best" is defined as the one with the
>least number of pieces matching "all".

>The other thing B news matches that C news doesn't is patterns like
>"comp.all.binaries".  (My perl function doesn't handle this yet.)

Here's one that does, but doesn't count the number of "all" matches
(I use this in my local backend inews).  Maybe we should merge our
versions?

sub ngmatch {
  local($ng,$pt) = @_;
  local(@ng_w,@pt_w);

  #
  # immediate match?
  #
  return 1 if ($ng eq $pt || $pt eq "all" || $pt eq "backbone");

  #
  # check for match on each word, using "all" as a wildcard
  #
  @ng_w = split(/\./, $ng);
  @pt_w = split(/\./, $pt);
  while ($#ng_w >= 0) {
    if ($#pt_w < 0) {
      shift(ng_w);
    } elsif ($ng_w[0] eq $pt_w[0] || $pt_w[0] eq "all") {
      shift(pt_w) if ($pt_w[0] ne "all" || $#pt_w >= $#ng_w);
      shift(ng_w);
    } else {
      return 0;
    }
  }
  return ($#ng_w == $#pt_w);
}
--
Mark Nagel
UC Irvine Department of ICS   +----------------------------------------+
ARPA: nagel@ics.uci.edu       | Six plus six equals fourteen for large |
UUCP: ucbvax!ucivax!nagel     | values of six -- Dave Ackerman         |
Technical Details
Message-ID: <25EEC570.16153@paris.ics.uci.edu>
Path: arc1-ca.pugleaf.net!utzoo!utstat!helios.physics.utoronto.ca!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!jarthur!uci-ics!nagel
References: <1990Mar1.225310.6802@wang.com> <1990Mar2.065300.20522@utstat.uucp> <Ebv56c1@cs.psu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utstat!helios.physics.utoronto.ca!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!jarthur!uci-ics!nagel
From: nagel@ics.uci.edu (Mark Nagel)
Newsgroups: news.software.b
Subject: Re: Newsgroup hierarchy and sys file confusion
Message-ID: <25EEC570.16153@paris.ics.uci.edu>
Date: 2 Mar 90 19:11:44 GMT
References: <1990Mar1.225310.6802@wang.com> <1990Mar2.065300.20522@utstat.uucp> <Ebv56c1@cs.psu.edu>
Lines: 46