🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #72171

Re: GNKSA questions (Noworyta News Reader)

#72171
From: Jeroen Scheerder
Date: Fri, 16 Feb 2001 19:17
113 lines
5707 bytes
Filip Noworyta <filnow@kki.net.pl>:

[snip, on restricting References -- pseudo-code]

> I use rather low-level C language, so it's not THAT easy, but 1. I
> really love (this word tells all) algorithms, 2. for this problem I used
> high-level AnsiString type. BTW: to programmers - char* i _much_
> faster for bigger files/buffers, for example for decoding/encoding big
> attachments.

Allow me a rephrase:

    if (refhdrtoolong(refhdr)) {
        char *second = skipfirstone(refhdr);
        while (refhdrtoolong(refhdr)) {
            removeonemsgid(second);
        }
    }

There, now it's C (with "refhdr" of type char *). :-)

More seriously: you may want to have a look at the GNKSA Tools
page, which also points to several libraries (including GNKSAlib)
that implement a few routines you should find interesting:
See <http://www.gnksa.org/gnksa-tools.html>.

[...]

> Well, you underestimate me - there are much harder problems in
> programming a newsreader than removing some msgids from references :) The
> algorithms are my passion and "Introduction to algorithms" by Cormen,
> Leiserson, Rivest, MIT, was one of the best books I have ever read.

I trust you're doing fine.  That is a fine book, I agree.

> >Things also get a lot simpler if you remove any broken msgids (as per
> >7e) first; actually, writing a routine that checks whether or not a
> >given msgid is syntactically correct may be a bit tougher than expected.
> 
> I don't remove broken msgids in this version :(

You'll find that, ready for everyday use, in GNKSAlib as well.

> >You may want to reread that bit of the RFCs.  They define it better, and
> >in more detail, than I can do in a few lines of a usenet articles.
> [...]
> Thanks for help!

No problem.  I've extracted a bit of information a while ago, and wrote
it in concise EBNF.  Not the best of formalisms, but it's more or less
what the relevant RFCs themselves use.  See below; it's from GNKSAlib's
gnksa.h, in which regular expressions for syntax validations are defined
which are derived directly from the RFC syntax definition.

> One more thing: this is really hard work and I'm also working on a
> e-mail part of my newsreader. Now I must stop sitting 20 cm from monitor
> 14 hours a day! :)

Yes, you should keep some balance.  All the more luck to you!


    -- J$
-- 
The overall syntax of a news article is:

   article         = 1*header separator body
   header          = start-line *continuation
   start-line      = header-name ":" space [ nonblank-text ] eol
   continuation    = space nonblank-text eol
   header-name     = 1*name-character *( "-" 1*name-character )
   name-character  = letter / digit
   letter          = <ASCII letter A-Z or a-z>
   digit           = <ASCII digit 0-9>
   separator       = eol
   body            = *( [ nonblank-text / space ] eol )
   eol             = <EOL>
   nonblank-text   = [ space ] text-character *( space-or-text )
   text-character  = <any ASCII character except NUL (ASCII 0),
                       HT (ASCII 9), LF (ASCII 10), CR (ASCII 13),
                       or blank (ASCII 32)>
   space           = 1*( <HT (ASCII 9)> / <blank (ASCII 32)> )
   space-or-text   = space / text-character

The  From header contains the electronic address, and possi-
bly the full name, of the article's author:

  From-content  = address [ space "(" paren-phrase ")" ]
                /  [ plain-phrase space ] "<" address ">"
  paren-phrase  = 1*( paren-char / space / encoded-word )
  paren-char    = <ASCII printable character except ()<>\>
  plain-phrase  = plain-word *( space plain-word )
  plain-word    = unquoted-word / quoted-word / encoded-word
  unquoted-word = 1*unquoted-char
  unquoted-char = <ASCII printable character except !()<>@,;:\".[]>
  quoted-word   = quote 1*( quoted-char / space ) quote
  quote         = <" (ASCII 34)>
  quoted-char   = <ASCII printable character except "()<>\>
  address       = local-part "@" domain
  local-part    = unquoted-word *( "." unquoted-word )
  domain        = unquoted-word *( "." unquoted-word )

  encoded-word  = "=?" charset "?" encoding "?" codes "?="
  charset       = 1*tag-char
  encoding      = 1*tag-char
  tag-char      = <ASCII printable character except !()<>@,;:\"[]/?=>
  codes         = 1*code-char
  code-char     = <ASCII printable character except ?>

The  Message-ID header:

  Message-ID-content  = message-id
  message-id          = "<" local-part "@" domain ">"
Technical Details
Message-ID: <1eoxubm.1lb44f9nsp1m3N@gnksa.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeeds.belnet.be!news.belnet.be!surfnet.nl!ruu.nl!phil.uu.nl!js
References: <96h44a$l0j9k$1@ID-70408.news.dfncis.de> <1eowzjh.syj5m47vz1fgN@gnksa.org> <96jp4p$lenkr$1@ID-70408.news.dfncis.de>

Show Full Headers
Complete Article Headers
Message-ID: <1eoxubm.1lb44f9nsp1m3N@gnksa.org>
Subject: Re: GNKSA questions (Noworyta News Reader)
Date: Fri, 16 Feb 2001 20:17:07 +0100
From: js@phil.uu.nl (Jeroen Scheerder)
References: <96h44a$l0j9k$1@ID-70408.news.dfncis.de> <1eowzjh.syj5m47vz1fgN@gnksa.org> <96jp4p$lenkr$1@ID-70408.news.dfncis.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeeds.belnet.be!news.belnet.be!surfnet.nl!ruu.nl!phil.uu.nl!js
Newsgroups: news.software.readers
Organization: Al-Munqidh min-al-Dalaal
Lines: 112
Sender: js@20dyn100.utr.casema.net
NNTP-Posting-Host: 20dyn100.utr.casema.net
X-Trace: husserl.admin.phil.uu.nl 982351033 10423 213.17.11.100 (16 Feb 2001 19:17:13 GMT)
X-Complaints-To: abuse@phil.uu.nl
NNTP-Posting-Date: 16 Feb 2001 19:17:13 GMT
Mail-Copies-To: nobody
X-Face: (u%,<Ek_K4]BW;*pmlV&,Ev+p0W0hHt,PZs7\2OV%HhTE5\$\MU79J|bQB_m3G"n,Mz'Pb6*(Z~Wr\GkY`X<!RfA0%7R
User-Agent: MacSOUP/2.4.6