rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

rpmio/strcasecmp.c
Go to the documentation of this file.

    00001
    00005 #include "system.h"
    00006 #include <rpmiotypes.h>
    00007 #include "debug.h"
    00008
    00009 int xstrcasecmp(const char * s1, const char * s2)
    00010 {
    00011   const char * p1 = s1;
    00012   const char * p2 = s2;
    00013   char c1, c2;
    00014
    00015   if (p1 == p2)
    00016     return 0;
    00017
    00018   do
    00019     {
    00020       c1 = (char) xtolower ((int)*p1++);
    00021       c2 = (char) xtolower ((int)*p2++);
    00022       if (c1 == '\0')
    00023         break;
    00024     }
    00025   while (c1 == c2);
    00026
    00027   return ((int)c1 - (int)c2);
    00028 }
    00029
    00030 int xstrncasecmp(const char *s1, const char *s2, size_t n)
    00031 {
    00032   const char * p1 = s1;
    00033   const char * p2 = s2;
    00034   char c1, c2;
    00035
    00036   if (p1 == p2 || n == 0)
    00037     return 0;
    00038
    00039   do
    00040     {
    00041       c1 = (char) xtolower ((int)*p1++);
    00042       c2 = (char) xtolower ((int)*p2++);
    00043       if (c1 == '\0' || c1 != c2)
    00044         break;
    00045     } while (--n > 0);
    00046
    00047   return ((int)c1 - (int)c2);
    00048 }