Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site fisher.UUCP
Path: utzoo!watmath!clyde!cbosgd!ihnp4!mhuxn!mhuxr!ulysses!allegra!princeton!astrovax!fisher!djl
From: djl@fisher.UUCP (Dan Levin  N6BZA )
Newsgroups: net.bugs
Subject: XENIX 3.0 toupper() and tolower() broken
Message-ID: <764@fisher.UUCP>
Date: Tue, 24-Sep-85 23:54:34 EDT
Article-I.D.: fisher.764
Posted: Tue Sep 24 23:54:34 1985
Date-Received: Sun, 29-Sep-85 04:13:40 EDT
Distribution: net
Organization: Princeton University.Mathematics
Lines: 28
Keywords: Intel Release, brain-damage

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