Functions

cbf_string.c File Reference

#include <ctype.h>
#include <stdlib.h>
Include dependency graph for cbf_string.c:

Go to the source code of this file.

Functions

int cbf_cistrcmp (const char *s1, const char *s2)
int cbf_cistrncmp (const char *s1, const char *s2, size_t n)

Function Documentation

int cbf_cistrcmp ( const char *  s1,
const char *  s2 
)

Definition at line 130 of file cbf_string.c.

Referenced by cbf_lex().

{
  while (*s1 && toupper (*s1) == toupper (*s2))
  { 
    s1++;
    s2++;
  }

  return toupper (*s1) - toupper (*s2);
}
int cbf_cistrncmp ( const char *  s1,
const char *  s2,
size_t  n 
)

Definition at line 144 of file cbf_string.c.

Referenced by cbf_parse_mimeheader().

{
  while (n > 0 && *s1 && toupper (*s1) == toupper (*s2))
  { 
    n--;
    s1++;
    s2++;
  }
  
  if (n == 0)
  
    return 0;

  return toupper (*s1) - toupper (*s2);
}