Signed-off-by: Alan Coopersmith <[email protected]>
---
 Xtrans.c    |  8 ++++++++
 Xtranslcl.c | 17 ++++++++++++++---
 xtrans.m4   |  3 +++
 3 files changed, 25 insertions(+), 3 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;
     }
 
diff --git a/Xtranslcl.c b/Xtranslcl.c
index f21f606..9eddf37 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -1714,9 +1714,8 @@ static LOCALtrans2dev *
 TRANS(LocalGetNextTransport)(void)
 
 {
-    int        i,j;
+    int                i;
     char       *typetocheck;
-    char       typebuf[TYPEBUFSIZE];
     prmsg(3,"LocalGetNextTransport()\n");
 
     while(1)
@@ -1731,6 +1730,9 @@ TRANS(LocalGetNextTransport)(void)
 
        for(i=0;i<NUMTRANSPORTS;i++)
        {
+#ifndef HAVE_STRCASECMP
+           int         j;
+           char        typebuf[TYPEBUFSIZE];
            /*
             * This is equivalent to a case insensitive strcmp(),
             * but should be more portable.
@@ -1742,6 +1744,9 @@ TRANS(LocalGetNextTransport)(void)
 
            /* Now, see if they match */
            if(!strcmp(LOCALtrans2devtab[i].transname,typebuf))
+#else
+           if(!strcasecmp(LOCALtrans2devtab[i].transname,typetocheck))
+#endif
                return &LOCALtrans2devtab[i];
        }
     }
@@ -2012,7 +2017,6 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, const 
char *protocol,
 {
     char *typetocheck = NULL;
     int found = 0;
-    char typebuf[TYPEBUFSIZE];
 
     prmsg(2,"LocalOpenCOTSServer(%s,%s,%s)\n",protocol,host,port);
 
@@ -2020,16 +2024,23 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, const 
char *protocol,
     TRANS(LocalInitTransports)("local");
     typetocheck = workingXLOCAL;
     while (typetocheck && !found) {
+#ifndef HAVE_STRCASECMP
        int j;
+       char typebuf[TYPEBUFSIZE];
+#endif
 
        workingXLOCAL = strchr(workingXLOCAL, ':');
        if (workingXLOCAL && *workingXLOCAL)
            *workingXLOCAL++ = '\0';
+#ifndef HAVE_STRCASECMP
        strncpy(typebuf, typetocheck, TYPEBUFSIZE);
        for (j = 0; j < TYPEBUFSIZE; j++)
            if (isupper(typebuf[j]))
                typebuf[j] = tolower(typebuf[j]);
        if (!strcmp(thistrans->TransName, typebuf))
+#else
+       if (!strcasecmp(thistrans->TransName, typetocheck))
+#endif
            found = 1;
        typetocheck = workingXLOCAL;
     }
diff --git a/xtrans.m4 b/xtrans.m4
index fe128b4..8215e87 100644
--- a/xtrans.m4
+++ b/xtrans.m4
@@ -134,6 +134,9 @@ AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
        AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
  fi
 
+ # Other functions Xtrans may need
+ AC_CHECK_FUNCS([strcasecmp strlcpy])
+
 ]) # XTRANS_CONNECTION_FLAGS
 
 
-- 
2.15.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to