diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-08-25 11:18:52 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-08-25 11:23:22 -0700 |
commit | 7bd504f7ab7799ab77ad50eb39f6afdbaf2f9e50 (patch) | |
tree | 06e5061d3468a07b7cd8d80d14859d20eed5c642 /Xtranslcl.c | |
parent | 941cfa50bc2d45f20943fd21bab98e2eceeeb259 (diff) |
Use strcasecmp if it's available, instead of lowercasing strings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'Xtranslcl.c')
-rw-r--r-- | Xtranslcl.c | 17 |
1 files changed, 14 insertions, 3 deletions
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; } |