Article View: net.bugs
Article #472XENIX 3.0 toupper() and tolower() broken
From: Dan Levin N6BZA
Date: Wed, 25 Sep 1985 03:54
Date: Wed, 25 Sep 1985 03:54
28 lines
1437 bytes
1437 bytes
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
Technical Details
Message-ID:
<764@fisher.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!mhuxn!mhuxr!ulysses!allegra!princeton!astrovax!fisher!djlShow Full Headers
Complete Article Headers
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: arc1-ca.pugleaf.net!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