summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-01-15 07:28:22 (GMT)
committerSung-Jin Park <sj76.park@samsung.com>2013-09-03 03:32:31 (GMT)
commit1b124856fcaded1fdf960f3de4452dbf1c5cfa1c (patch)
treed9432ed8db867361187c36f6af8d8ee5ec15a784
parentb5d4fbbbec372bd3aa43afa405421a21146e7a53 (diff)
downloadxev-1b124856fcaded1fdf960f3de4452dbf1c5cfa1c.zip
xev-1b124856fcaded1fdf960f3de4452dbf1c5cfa1c.tar.gz
xev-1b124856fcaded1fdf960f3de4452dbf1c5cfa1c.tar.bz2
Use strncasecmp instead of a tolower loop & strncmprefs/changes/09/9209/1
v2: Since strncasecmp is in Unix98, assume it is always available, and drop fallback code for systems without it. Change-Id: I75ea1ac5eb90259af8faf505b75f98cadf15a1d2 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--configure.ac1
-rw-r--r--xev.c15
2 files changed, 7 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index 0af7b2d..c65d82a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@ AC_INIT([xev], [1.2.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xev])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
+AC_USE_SYSTEM_EXTENSIONS
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
diff --git a/xev.c b/xev.c
index 34a46aa..066da3a 100644
--- a/xev.c
+++ b/xev.c
@@ -32,6 +32,9 @@ from the X Consortium.
* Author: Jim Fulton, MIT X Consortium
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -907,16 +910,10 @@ static int
parse_backing_store (char *s)
{
size_t len = strlen (s);
- char *cp;
-
- for (cp = s; *cp; cp++) {
- if (isascii (*cp) && isupper (*cp))
- *cp = tolower (*cp);
- }
- 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);
usage ();
}