Xref: utzoo comp.sources.bugs:2900 comp.mail.mush:1173 comp.lang.c:38985 Path: 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 >> } > 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 "=="?