🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.bugs
Article #640

"str*cmp()" ain't Boolean (was Re: v18i058: mush - Mail User's Shell, Part01/22)

#640
From: Guy Harris
Date: Fri, 03 May 1991 21:17
10 lines
937 bytes
 >> } >   if (show_to && strncmp(p, login, strlen(login)))
 >
 >> My copy says !strncmp(p, login, strlen(login)) ....
 >
 >Ooops.  Finger trouble.  So does mine.

Perhaps this is a hint that one shouldn't treat "strncmp()" as if it
were a Boolean function, and should instead compare its result with 0
explicitly, e.g. if you're comparing strings for equality, use "=="?
Technical Details
Message-ID: <7609@auspex.auspex.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ukma!wuarchive!uunet!auspex!guy
References: <1991Apr24.220750.15603@robobar.co.uk> <20523@ogicse.ogi.edu> <1991May1.181910.28750@robobar.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ukma!wuarchive!uunet!auspex!guy
From: guy@auspex.auspex.com (Guy Harris)
Newsgroups: comp.sources.bugs,comp.mail.mush,comp.lang.c
Subject: "str*cmp()" ain't Boolean (was Re: v18i058:  mush - Mail User's Shell, Part01/22)
Message-ID: <7609@auspex.auspex.com>
Date: 3 May 91 21:17:36 GMT
References: <1991Apr24.220750.15603@robobar.co.uk> <20523@ogicse.ogi.edu> <1991May1.181910.28750@robobar.co.uk>
Followup-To: comp.lang.c
Organization: Auspex Systems, Santa Clara
Lines: 10