diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-06-06 20:59:55 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-06-06 20:59:55 -0700 |
commit | 9a38344f4724124a79606752a519d50a8fbab383 (patch) | |
tree | a541d11960cbda264b5eb72ddcb453830be94ba3 | |
parent | ad55265d5a2140e4d4bed0bd1ce0c5a16654f101 (diff) |
Use system strcasecmp if it has one
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | xsetpointer.c | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 079e7d7..38e50b3 100644 --- a/configure.ac +++ b/configure.ac @@ -38,6 +38,8 @@ AC_PROG_INSTALL XORG_DEFAULT_OPTIONS +AC_CHECK_FUNCS([strcasecmp]) + # Checks for pkg-config packages PKG_CHECK_MODULES(XSETPOINTER, xi x11 [inputproto >= 1.4]) AC_SUBST(XSETPOINTER_CFLAGS) diff --git a/xsetpointer.c b/xsetpointer.c index b85bcf6..8ffbaa5 100644 --- a/xsetpointer.c +++ b/xsetpointer.c @@ -23,13 +23,19 @@ * */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <X11/Xproto.h> #include <X11/extensions/XInput.h> +#ifndef HAVE_STRCASECMP +#include <ctype.h> + static int StrCaseCmp(char *s1, char *s2) { @@ -54,6 +60,9 @@ StrCaseCmp(char *s1, char *s2) return(c1 - c2); } +#define strcasecmp StrCaseCmp +#endif + int main(int argc, char * argv[]) { @@ -137,7 +146,7 @@ main(int argc, char * argv[]) } else if (core) { if (argc == 3 && devices[loop].name && - StrCaseCmp(devices[loop].name, argv[2]) == 0) { + strcasecmp(devices[loop].name, argv[2]) == 0) { #ifdef DEBUG fprintf(stderr, "opening device %s at %d\n", devices[loop].name ? devices[loop].name : "<noname>", @@ -160,7 +169,7 @@ main(int argc, char * argv[]) } else { if ((argc == 2) && devices[loop].name && - (StrCaseCmp(devices[loop].name, argv[1]) == 0)) + (strcasecmp(devices[loop].name, argv[1]) == 0)) if (devices[loop].use == IsXExtensionDevice) { #ifdef DEBUG |