On 01/15/13 03:51 PM, Peter Hutterer wrote:
>> +#ifndef HAVE_STRNCASECMP
>> char *cp;
>>
>> for (cp = s; *cp; cp++) {
>> if (isascii (*cp) && isupper (*cp))
>> *cp = tolower (*cp);
>> }
>> +#define strncasecmp strncmp
>> +#endif
>>
>> - if (strncmp (s, "notuseful", len) == 0) return (NotUseful);
>> - if (strncmp (s, "whenmapped", len) == 0) return (WhenMapped);
>> - if (strncmp (s, "always", len) == 0) return (Always);
>> + if (strncasecmp (s, "notuseful", len) == 0) return (NotUseful);
>> + if (strncasecmp (s, "whenmapped", len) == 0) return (WhenMapped);
>> + if (strncasecmp (s, "always", len) == 0) return (Always);
>
> which systems do we support that don't have strncasecmp?
Good question - I remembered other Xorg configure scripts checking for it, but
I don't know why, and checking the Unix98 spec it was included there:
http://pubs.opengroup.org/onlinepubs/007908799/xsh/strcasecmp.html
so it should be in our supported baseline. Anyone know of any reason we can't
just assume strncasecmp and drop the #ifndef case above?
> the man page suggests uppercase spelling "-bs {NotUseful,WhenMapped,Always}"
> so this could break on those systems. maybe change the above to match the
> spelling in the man page?
How would it break? They'd use the old code that does tolower on the input
before comparison - if we require strncasecmp and drop support for them, then
we could uppercase with impunity.
--
-Alan Coopersmith- [email protected]
Oracle Solaris Engineering - http://blogs.oracle.com/alanc
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel