delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/29/07:53:21

Date: Sun, 29 Jul 2001 13:33:55 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Thorsten Erdmann <thorsten-erdmann AT t-online DOT de>
cc: djgpp AT delorie DOT com
Subject: Re: Problems with strupr etc.
In-Reply-To: <006301c1181e$0ed4d800$0c64a8c0@tpc2>
Message-ID: <Pine.SUN.3.91.1010729132838.2410G-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 29 Jul 2001, Thorsten Erdmann wrote:

> I have some problems with the strupr and strlower functions and the ones
> which are based upon, like stricmp.
> If strupr finds a non ASCI character like 128 or higher it breaks at that
> point leaving the string incomplete or it places illegal characters there.
> The right behaviour would be to leave the character as it is. Maybe it is
> something with signed or unsigned characters, since it only happens with
> characters higher or equal than 128.

What version of DJGPP do you have?  These problems should be solved in 
DJGPP v2.03.  Please see what does the header sys/version.h say about 
your library version.

> I looked at the sources and found that strupr calls toupper, so I tried
> that - with the same result. So I copied the source of toupper in my own C
> souzrce to debug it - and the error is gone. Mysterious !

The problem (that was corrected in v2.03) was that characters with high 
bit set were converted into negative integers, and then the table of the 
character properties was entered using that negative number as an index.  
This references some memory outside the table, so the results depend on 
the exact layout of the variables in memory.  If you change the order of 
function linking, you change the results as well.

In other words, bugs frequently behave in mysterious ways ;-)

> BTW. How can I rebuilt libc. The makefile only gives error messages.

Chdir to the src directory and type "make".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019