Date: Sun, 29 Jul 2001 13:33:55 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Thorsten Erdmann cc: djgpp AT delorie DOT com Subject: Re: Problems with strupr etc. In-Reply-To: <006301c1181e$0ed4d800$0c64a8c0@tpc2> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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".