Article View: alt.privacy.anon-server
Article #47016Re: The triumph of Richard Heathfield, was: The demise of Richard Heathfield
From: Richard Heathfield
Date: Wed, 13 Nov 2002 19:43
Date: Wed, 13 Nov 2002 19:43
72 lines
3798 bytes
3798 bytes
Bryan Olson wrote:
>
> Thomas J. Boschloo wrote:
<snip>
> > I think I see an unchecked buffer here, so I assume the whole post is a
> > nut post to paraphrase your own words.
>
> You think wrong. Perhaps you are unaware how the string class in
> the C++ standard library works. Chalk another one up for Richard.
Thanks, Bryan. I don't think I'll be paying any more attention to Mr
Boschloo, since he seems more interested in fighting than in learning.
Arrogance on Usenet is not uncommon, and neither is ignorance, but to
find them together in such abundance is blessedly rare.
Ironically, the code I posted /did/ have a bug, albeit not the one Mr
Boschloo thought he'd found. If only he'd looked a little closer, he
might have spotted it before I did. The problem was that my definitions
of what is, and what is not, part of a word did not form a complete
non-overlapping set.
The following fix replaces one function - GetWord() - from the code I
posted earlier, and introduces another function - Is_WordPart() - which
you can change if your definition of "word" differs from that given here
(which I freely admit is rather simplistic and thus unsatisfactory):
int Is_WordPart(int ch)
{
return (isalpha((unsigned char)ch) || '\'' == ch || '-' == ch);
}
int GetWord(string &word, FILE *fp)
{
int result = 0;
int ch;
word = "";
/* skip leading spaces */
do
{
ch = fgetc(fp);
} while(ch != EOF && !Is_WordPart(ch));
if(ch != EOF)
{
do
{
word += ch;
ch = fgetc(fp);
} while(ch != EOF && Is_WordPart(ch));
}
if(EOF == ch)
{
result = 1;
}
return result;
}
Parsing English programmatically is a Sisyphean task. As far as I'm
concerned, if the rock wants to roll downhill, let it. :-)
--
Richard Heathfield : binary@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Technical Details
Message-ID:
<3DD2AB47.11DE20A6@eton.powernet.co.uk>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.security.pgp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!peer1.news.newnet.co.uk!lon1-news.nildram.net!195.60.31.14.MISMATCH!news2.power.net.uk!news.power.net.ukReferences:
<3DC1596C.6D2B55BD@hccnet.nl.invalid> <3DC526FC.CBCFE9B6@hccnet.nl.invalid> <3DC5451F.DBF3CDDA@eton.powernet.co.uk> <pan.2002.11.03.17.05.02.482162@yahoo.co.uk> <3DC81975.45915377@hccnet.nl.invalid> <3DC85EA2.2C8E26DA@earthlink.net> <3DC95533.512AB0A3@hccnet.nl.invalid> <3DC976DA.32815A18@earthlink.net> <3DCBC0A8.F3785708@hccnet.nl.invalid> <3DCC0E5A.4C70F9F@eton.powernet.co.uk> <3DCD229B.1F302611@hccnet.nl.invalid> <3DCD3356.EBE0DD11@eton.powernet.co.uk> <3DD2955F.61C2149@hccnet.nl.invalid> <KNwA9.1284$pg4.27042958@newssvr14.news.prodigy.com>Show Full Headers
Complete Article Headers
Message-ID: <3DD2AB47.11DE20A6@eton.powernet.co.uk> Subject: Re: The triumph of Richard Heathfield, was: The demise of Richard Heathfield Date: Wed, 13 Nov 2002 19:43:03 +0000 From: Richard Heathfield <binary@eton.powernet.co.uk> References: <3DC1596C.6D2B55BD@hccnet.nl.invalid> <3DC526FC.CBCFE9B6@hccnet.nl.invalid> <3DC5451F.DBF3CDDA@eton.powernet.co.uk> <pan.2002.11.03.17.05.02.482162@yahoo.co.uk> <3DC81975.45915377@hccnet.nl.invalid> <3DC85EA2.2C8E26DA@earthlink.net> <3DC95533.512AB0A3@hccnet.nl.invalid> <3DC976DA.32815A18@earthlink.net> <3DCBC0A8.F3785708@hccnet.nl.invalid> <3DCC0E5A.4C70F9F@eton.powernet.co.uk> <3DCD229B.1F302611@hccnet.nl.invalid> <3DCD3356.EBE0DD11@eton.powernet.co.uk> <3DD2955F.61C2149@hccnet.nl.invalid> <KNwA9.1284$pg4.27042958@newssvr14.news.prodigy.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.security.pgp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!peer1.news.newnet.co.uk!lon1-news.nildram.net!195.60.31.14.MISMATCH!news2.power.net.uk!news.power.net.uk Organization: Eton Computer Systems Ltd X-Mailer: Mozilla 4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk (WinNT; I) X-Accept-Language: en-GB,en MIME-Version: 1.0 Newsgroups: alt.privacy.anon-server,sci.crypt,alt.fan.cult-dead-cow,alt.security.pgp Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 195.60.5.56 X-Trace: news.power.net.uk 1037216486 195.60.5.56 (13 Nov 2002 19:41:26 GMT) Lines: 73