diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-01-14 23:28:22 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-01-19 08:38:02 -0800 |
commit | f02bf10367271b6713cdf231771e5320474fcc15 (patch) | |
tree | d9432ed8db867361187c36f6af8d8ee5ec15a784 /xev.c | |
parent | 6731b622587e83572452c96423195528579fd98d (diff) |
Use strncasecmp instead of a tolower loop & strncmp
v2: Since strncasecmp is in Unix98, assume it is always available,
and drop fallback code for systems without it.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xev.c')
-rw-r--r-- | xev.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -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 (); } |