From: Alan Coopersmith Date: Tue, 17 Jul 2007 22:57:10 +0000 (-0700) Subject: Use strncasecmp if we can, instead of our own homegrown strncmp_nocase X-Git-Tag: xmodmap-1.0.3~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=822b6bffce953041accc13f4633d2c5d4a8c8dcd;p=platform%2Fupstream%2Fxmodmap.git Use strncasecmp if we can, instead of our own homegrown strncmp_nocase --- diff --git a/configure.ac b/configure.ac index 089720f..4216294 100644 --- a/configure.ac +++ b/configure.ac @@ -31,6 +31,8 @@ AM_CONFIG_HEADER(config.h) AC_PROG_CC AC_PROG_INSTALL +AC_CHECK_FUNCS([strncasecmp]) + # Checks for pkg-config packages PKG_CHECK_MODULES(DEP, x11) AC_SUBST(DEP_CFLAGS) diff --git a/handle.c b/handle.c index 61e819f..5d457b4 100644 --- a/handle.c +++ b/handle.c @@ -28,6 +28,7 @@ from The Open Group. */ /* $XFree86: xc/programs/xmodmap/handle.c,v 3.6 2001/07/25 15:05:27 dawes Exp $ */ +#include "config.h" #include #include #include @@ -791,8 +792,9 @@ do_clear(char *line, int len) add_to_work_queue (uop); } +#ifndef HAVE_STRNCASECMP static int -strncmp_nocase(const char *a, const char *b, int n) +strncasecmp(const char *a, const char *b, int n) { int i; int a1, b1; @@ -809,7 +811,7 @@ strncmp_nocase(const char *a, const char *b, int n) } return 0; } - +#endif /* * do_pointer = get list of numbers of the form @@ -851,7 +853,7 @@ do_pointer(char *line, int len) line += n, len -= n; i = 0; - if (len < 7 || strncmp_nocase (line, "default", 7) != 0) { + if (len < 7 || strncasecmp (line, "default", 7) != 0) { while (len > 0) { n = skip_space (line, len); line += n, len -= n;