home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / mbsicoll.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  1KB  |  63 lines

  1. /***
  2. *mbsicoll.c - Collate MBCS strings, ignoring case
  3. *
  4. *       Copyright (c) 1994-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       Collate MBCS strings, ignoring case
  8. *
  9. *******************************************************************************/
  10.  
  11. #ifdef _MBCS
  12.  
  13. #if defined (_WIN32)
  14. #include <awint.h>
  15. #include <mtdll.h>
  16. #endif  /* defined (_WIN32) */
  17.  
  18. #include <cruntime.h>
  19. #include <internal.h>
  20. #include <mbdata.h>
  21. #include <mbctype.h>
  22. #include <mbstring.h>
  23.  
  24. /***
  25. * _mbsicoll - Collate MBCS strings, ignoring case
  26. *
  27. *Purpose:
  28. *       Collates two strings for lexical order.   Strings
  29. *       are collated on a character basis, not a byte basis.
  30. *
  31. *Entry:
  32. *       char *s1, *s2 = strings to collate
  33. *
  34. *Exit:
  35. *       returns <0 if s1 < s2
  36. *       returns  0 if s1 == s2
  37. *       returns >0 if s1 > s2
  38. *
  39. *Exceptions:
  40. *
  41. *******************************************************************************/
  42.  
  43. int __cdecl _mbsicoll(
  44.     const unsigned char *s1,
  45.     const unsigned char *s2
  46.     )
  47. {
  48. #if !defined (_WIN32)
  49.         return _mbsicmp(s1, s2);
  50. #else  /* !defined (_WIN32) */
  51.         int ret;
  52.  
  53.         if (0 == (ret = __crtCompareStringA(__mblcid, NORM_IGNORECASE,
  54.                 s1, -1, s2, -1, __mbcodepage)))
  55.             return _NLSCMPERROR;
  56.  
  57.         return ret - 2;
  58.  
  59. #endif  /* !defined (_WIN32) */
  60. }
  61.  
  62. #endif  /* _MBCS */
  63.