strcase.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Case-insensitive string comparison functions.
  2. Copyright (C) 1995-1996, 2001, 2003, 2005-2006 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  14. #ifndef _STRCASE_H
  15. #define _STRCASE_H
  16. #include <stddef.h>
  17. /* Include header files with a possibly conflicting declarations of strcasecmp
  18. before we define it as a macro, so that they will be no-ops if included
  19. after strcasecmp is defined as a macro. */
  20. #include <string.h>
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* No known system has a strcasecmp() function that works correctly in
  25. multibyte locales. Therefore we use our version always. */
  26. #define strcasecmp rpl_strcasecmp
  27. /* Compare strings S1 and S2, ignoring case, returning less than, equal to or
  28. greater than zero if S1 is lexicographically less than, equal to or greater
  29. than S2.
  30. Note: This function may, in multibyte locales, return 0 for strings of
  31. different lengths! */
  32. extern int strcasecmp (const char *s1, const char *s2);
  33. /* Compare no more than N characters of strings S1 and S2, ignoring case,
  34. returning less than, equal to or greater than zero if S1 is
  35. lexicographically less than, equal to or greater than S2.
  36. Note: This function can not work correctly in multibyte locales. */
  37. #if ! HAVE_DECL_STRNCASECMP
  38. extern int strncasecmp (const char *s1, const char *s2, size_t n);
  39. #endif
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif /* _STRCASE_H */