www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/11/27/19:11:22

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: Re: B19, EGCS 1.1: Strcasecmp uses uppercase?
27 Nov 1998 19:11:22 -0800 :
Message-ID: <199811272053.OAA21813.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <3 DOT 0 DOT 5 DOT 32 DOT 19981127103534 DOT 00947a10 AT pop DOT cs DOT uu DOT nl>
To: Steven van Dijk <steven AT cs DOT uu DOT nl>
Cc: gnu-win32 AT cygnus DOT com

Steven van Dijk <steven AT cs DOT uu DOT nl> writes:
> 
> #include <stdio.h>
> #include <string.h>
> 
> main()
> {
>         char * s1 = "String";
>         char * s2 = "S_";
> 
>         printf("Comparing s1 with s2 returns: %d\n", strcasecmp(s1,s2));
> }
> 
> On my system (using b19, no patches and EGCS 1.1) I get:
> Comparing s1 with s2 returns: -11
> 
> and on the Unix system I get:
> Comparing s1 with s2 returns: 21

This is a bug in newlib string handling routines. I'll submit a patch to
the cygwin folks.

Thanks for pointing it out with a test case. There is a workaround until
the patch makes it in -- always specify the *longer* string as the *second*
argument.

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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