XENIX 3.0 toupper() and tolower() broken

Dan Levin N6BZA djl at fisher.UUCP
Wed Sep 25 13:54:34 AEST 1985


Found this one while trying to make sendmail work,... all the lines of
the form
From:
To:
Date:
came out of the form
Rom:
O:
Ate:

Seems that the XENIX 3.0 ctype.h has toupper() and tolower() defined as
macros like this,...
#define toupper(x) (ifsomething(x) ? dosomething(x) : (x))
which breaks badly if (x) is autoincrement or autodecrement. Ie.
toupper(s++) goes to (ifsomething(s++) ? donesomething(s++) : (s++)),
which is clearly wrong.

The fix is to ctype.h, to not use the trinary operator; or to use the
libc versions instead (by #undef'ing toupper() and tolower());

NB:  This only holds for the Intel distribution, I have not checked the
IBM XENIX 3.0 release.

-- 
			***dan

{allegra,astrovax,princeton,twg}!fisher!djl
The misplaced (You call *that* a ski slope??) Californian



More information about the Net.bugs mailing list