From 6bc02f74af03e65b5bb62450c1be43ea0f5d2989 Mon Sep 17 00:00:00 2001 From: Julien Grall Date: Wed, 28 Aug 2013 15:47:20 +0100 Subject: xen: Add new string function Add strcasecmp. The code is copied from Linux. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- xen/common/string.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'xen/common') diff --git a/xen/common/string.c b/xen/common/string.c index db9d9d5199..9a5a4ba5e8 100644 --- a/xen/common/string.c +++ b/xen/common/string.c @@ -41,6 +41,21 @@ int strnicmp(const char *s1, const char *s2, size_t len) } #endif +#ifndef __HAVE_ARCH_STRCASECMP +int strcasecmp(const char *s1, const char *s2) +{ + int c1, c2; + + do + { + c1 = tolower(*s1++); + c2 = tolower(*s2++); + } while ( c1 == c2 && c1 != 0 ); + + return c1 - c2; +} +#endif + #ifndef __HAVE_ARCH_STRLCPY /** * strlcpy - Copy a %NUL terminated string into a sized buffer -- cgit v1.2.3