Path: utzoo!attcan!uunet!munnari.oz.au!comp.vuw.ac.nz!lloyd From: L.Parkes@comp.vuw.ac.nz (Lloyd Parkes) Newsgroups: comp.os.minix Subject: Re: Bugs in adventure Message-ID: Date: 7 Jun 90 00:09:59 GMT References: <21103@nigel.udel.EDU> <1939@cod.NOSC.MIL> Sender: news@comp.vuw.ac.nz (News Admin) Organization: Dept. of Computer Science, Victoria Uni. of Wellington, NZ. Lines: 28 In-Reply-To: hall@cod.NOSC.MIL's message of 6 Jun 90 14:41:41 GMT In article <1939@cod.NOSC.MIL> hall@cod.NOSC.MIL (Robert R. Hall) writes: > Two bugs I found within a few minutes: > > 1) use tolower and toupper defensively, that is, check if the argument > is really uppercase when using tolower. > I had to fix it on our SUN here by changing the SUN include-files. > sure the errors will revive when I install the next OS update. > I don't understand. In the Minix file /usr/include/ctype.h I find with MINIX> grep -n tolower /usr/include/ctype.h 54: * The macro 'tolower' only affects upper case letters, and 'toupper' 58: * #define tolower(c) (isupper(c) ? c - 'A' + 'a' : c) 66:#define tolower(c) (__tmp = (c), isupper(__tmp) ? __tmp - 'A' + 'a' : __tmp) Your suggested defensive protection appears to be there to me. You should always use tolower & toupper in a defensive manner, because they are only defined for upper & lower case characters respectively. Failing to do this has caused me some headaches when porting stuff. Lloyd -- ------------------------------------------------------------------------ Lloyd Parkes | Bix Licks Stick's Tricks lloyd@comp.vuw.ac.nz | Bix Barton Master of the Rum and Uncanny ------------------------------------------------------------------------