Commit 83b820b1 authored by Niels Möller's avatar Niels Möller
Browse files

(strcasecmp): New file.

Rev: src/argp/configure.ac:1.16
Rev: src/argp/strcasecmp.c:1.1
parent d03cbad0
...@@ -38,9 +38,9 @@ LSH_GCC_ATTRIBUTES ...@@ -38,9 +38,9 @@ LSH_GCC_ATTRIBUTES
# Checks for library functions. # Checks for library functions.
AC_FUNC_ALLOCA AC_FUNC_ALLOCA
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strerror, sleep, getpid) AC_CHECK_FUNCS(strerror sleep getpid)
AC_REPLACE_FUNCS(mempcpy strndup strchrnul) AC_REPLACE_FUNCS(mempcpy strndup strchrnul strcasecmp)
dnl ARGP_CHECK_FUNC(includes, function-call [, if-found [, if-not-found]]) dnl ARGP_CHECK_FUNC(includes, function-call [, if-found [, if-not-found]])
AC_DEFUN([ARGP_CHECK_FUNC], AC_DEFUN([ARGP_CHECK_FUNC],
......
/* strcasecmp.c
*
*/
/* Written by Niels Mller <nisse@lysator.liu.se>
*
* This file is hereby placed in the public domain.
*/
#include <ctype.h>
int strcasecmp(const char *s1, const char *s2)
{
unsigned i;
for (i = 0; s1[i] && s2[i]; i++)
{
unsigned char c1 = tolower( (unsigned char) s1[i]);
unsigned char c2 = tolower( (unsigned char) s2[i]);
if (c1 < c2)
return -1;
else if (c1 > c2)
return 1;
}
return !s2[i] - !s1[i];
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment