home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / word2x0a.zip / source / compat.c < prev    next >
C/C++ Source or Header  |  1997-04-12  |  776b  |  59 lines

  1. /* $Id: compat.c,v 1.2 1997/04/13 05:51:35 dps Exp $ */
  2.  
  3. #include "config.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7.  
  8. #ifndef HAVE_STRCASECMP
  9. int strcasecmp(const char *s, const char *t)
  10. {
  11.     register unsigned char a,b;
  12.  
  13.     while (*s && *t)
  14.     {
  15.     a=tolower(*s);
  16.     b=tolowet(*t);
  17.     if (a<b)
  18.         return -1;
  19.     if (a>b)
  20.         return 1;
  21.     s++;
  22.     t++;
  23.     }
  24.     if (*s!='\0')
  25.     return -1;
  26.     if (*t!='\0')
  27.     return 1;
  28.     return 0;
  29. }
  30. #endif
  31.  
  32. #ifndef HAVE_STRNCASECMP
  33. int strcasecmp(const char *s, const char *t)
  34. {
  35.     register unsigned char a,b;
  36.  
  37.     while (*s && *t)
  38.     {
  39.     a=tolower(*s);
  40.     b=tolowet(*t);
  41.     if (a<b)
  42.         return -1;
  43.     if (a>b)
  44.         return 1;
  45.     s++;
  46.     t++;
  47.     }
  48.     if (*s!='\0')
  49.     return -1;
  50.     if (*t!='\0')
  51.     return 1;
  52.     return 0;
  53. }
  54. #endif
  55.  
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59.