summaryrefslogtreecommitdiff
path: root/Xtrans.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2018-08-25 11:18:52 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2018-08-25 11:23:22 -0700
commit7bd504f7ab7799ab77ad50eb39f6afdbaf2f9e50 (patch)
tree06e5061d3468a07b7cd8d80d14859d20eed5c642 /Xtrans.c
parent941cfa50bc2d45f20943fd21bab98e2eceeeb259 (diff)
downloadxorg-lib-libxtrans-7bd504f7ab7799ab77ad50eb39f6afdbaf2f9e50.tar.gz
Use strcasecmp if it's available, instead of lowercasing strings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'Xtrans.c')
-rw-r--r--Xtrans.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Xtrans.c b/Xtrans.c
index 46dc6b9..0e09b25 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -153,11 +153,14 @@ static Xtransport *
TRANS(SelectTransport) (const char *protocol)
{
+#ifndef HAVE_STRCASECMP
char protobuf[PROTOBUFSIZE];
+#endif
int i;
prmsg (3,"SelectTransport(%s)\n", protocol);
+#ifndef HAVE_STRCASECMP
/*
* Force Protocol to be lowercase as a way of doing
* a case insensitive match.
@@ -169,12 +172,17 @@ TRANS(SelectTransport) (const char *protocol)
for (i = 0; i < PROTOBUFSIZE && protobuf[i] != '\0'; i++)
if (isupper ((unsigned char)protobuf[i]))
protobuf[i] = tolower ((unsigned char)protobuf[i]);
+#endif
/* Look at all of the configured protocols */
for (i = 0; i < NUMTRANS; i++)
{
+#ifndef HAVE_STRCASECMP
if (!strcmp (protobuf, Xtransports[i].transport->TransName))
+#else
+ if (!strcasecmp (protocol, Xtransports[i].transport->TransName))
+#endif
return Xtransports[i].transport;
}