home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / evbl0627.zip / everblue_20010627.zip / x11 / Xlc_Util.c < prev    next >
C/C++ Source or Header  |  1999-11-02  |  2KB  |  81 lines

  1. /* $XConsortium: lcUtil.c,v 1.3 94/01/20 18:07:47 rws Exp $ */
  2. /*
  3.  * Copyright 1992, 1993 by TOSHIBA Corp.
  4.  *
  5.  * Permission to use, copy, modify, and distribute this software and its
  6.  * documentation for any purpose and without fee is hereby granted, provided
  7.  * that the above copyright notice appear in all copies and that both that
  8.  * copyright notice and this permission notice appear in supporting
  9.  * documentation, and that the name of TOSHIBA not be used in advertising
  10.  * or publicity pertaining to distribution of the software without specific,
  11.  * written prior permission. TOSHIBA make no representations about the
  12.  * suitability of this software for any purpose.  It is provided "as is"
  13.  * without express or implied warranty.
  14.  *
  15.  * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17.  * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21.  * SOFTWARE.
  22.  *
  23.  * Author: Katsuhisa Yano    TOSHIBA Corp.
  24.  *                   mopi@osa.ilab.toshiba.co.jp
  25.  */
  26.  
  27. #include <stdio.h>
  28. #include <ctype.h>
  29. #include "Xlib_private.h"
  30. #include <X11/Xos.h>
  31.  
  32. #ifdef X_NOT_STDC_ENV
  33. #ifndef toupper
  34. #define toupper(c)      ((int)(c) - 'a' + 'A')
  35. #endif
  36. #endif
  37.  
  38. int 
  39. _XlcCompareISOLatin1(str1, str2)
  40.     char *str1, *str2;
  41. {
  42.     DBUG_ENTER("_XlcCompareISOLatin1")
  43.     register char ch1, ch2;
  44.  
  45.     for ( ; (ch1 = *str1) && (ch2 = *str2); str1++, str2++) {
  46.         if (islower(ch1))
  47.             ch1 = toupper(ch1);
  48.         if (islower(ch2))
  49.             ch2 = toupper(ch2);
  50.  
  51.         if (ch1 != ch2)
  52.             break;
  53.     }
  54.  
  55.     DBUG_RETURN(*str1 - *str2);
  56. }
  57.  
  58. int 
  59. _XlcNCompareISOLatin1(str1, str2, len)
  60.     char *str1, *str2;
  61.     int len;
  62. {
  63.     DBUG_ENTER("_XlcNCompareISOLatin1")
  64.     register char ch1, ch2;
  65.  
  66.     for ( ; (ch1 = *str1) && (ch2 = *str2) && len; str1++, str2++, len--) {
  67.         if (islower(ch1))
  68.             ch1 = toupper(ch1);
  69.         if (islower(ch2))
  70.             ch2 = toupper(ch2);
  71.  
  72.         if (ch1 != ch2)
  73.             break;
  74.     }
  75.  
  76.     if (len == 0)
  77.         DBUG_RETURN(0);
  78.  
  79.     DBUG_RETURN(*str1 - *str2);
  80. }
  81.