Logo Search packages:      
Sourcecode: likewise-open version File versions

int strwicmp ( const char *  psz1,
const char *  psz2 
)

Do a case-insensitive, whitespace-ignoring string compare.

Definition at line 345 of file util_str.c.

{
      /* if BOTH strings are NULL, return TRUE, if ONE is NULL return */
      /* appropriate value. */
      if (psz1 == psz2)
            return (0);
      else if (psz1 == NULL)
            return (-1);
      else if (psz2 == NULL)
            return (1);

      /* sync the strings on first non-whitespace */
      while (1) {
            while (isspace((int)*psz1))
                  psz1++;
            while (isspace((int)*psz2))
                  psz2++;
            if (toupper_ascii(*psz1) != toupper_ascii(*psz2) ||
                        *psz1 == '\0' || *psz2 == '\0')
                  break;
            psz1++;
            psz2++;
      }
      return (*psz1 - *psz2);
}


Generated by  Doxygen 1.6.0   Back to index