Logo Search packages:      
Sourcecode: sofia-sip version File versions

char* strcasestr ( char const *  haystack,
char const *  needle 
)

REGISTER and registrations.

auth_common.c

Functions common to both client and server authentication.

Author:
Pekka Pessi <Pekka.Pessi@nokia.com>
Date:
Original Created: Thu Feb 22 12:10:37 2001 ppessi

Created: Wed May 17 13:37:50 EEST 2006 ppessi

Definition at line 37 of file strcasestr.c.

{
  unsigned char lcn, ucn;
  unsigned i;

  if (haystack == NULL || needle == NULL)
    return NULL;

  lcn = ucn = needle[0];
  if (isupper(lcn))
    lcn = tolower(lcn);
  else if (islower(ucn))
    ucn = toupper(ucn);

  if (lcn == 0)
    return (char *)haystack;

  while (haystack[0] != 0) {
    if (lcn == haystack[0] || ucn == haystack[0]) {
      for (i = 1; ; i++) {
      char n = needle[i], h = haystack[i];
      if (n == 0)
        return (char *)haystack;
      if (h == 0)
        return NULL;
      if (isupper(n)) n = tolower(n);
      if (isupper(h)) h = tolower(h);
      if (n != h)
        break;
      }
    }
    haystack++;
  }

  return NULL;          /* Not found */
}


Generated by  Doxygen 1.6.0   Back to index