Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
strings.c File Reference
#include <string.h>
#include <stdlib.h>
#include "ldap-macos.h"

Go to the source code of this file.

Functions

int strcasecmp (const char *s1, const char *s2)
 Case-insensitive string comparison.
int strncasecmp (const char *s1, const char *s2, const long n)
char * strdup (const char *p)
 Duplicates a C string, returns NULL if failed, or passed NULL.

Variables

static char charmap []

Function Documentation

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

Case-insensitive string comparison.

Definition at line 94 of file strings.c.

{
       register char *cm = charmap;

       while (cm[*s1] == cm[*s2++])
              if (*s1++ == '\0')
                     return(0);
       return cm[*s1] - cm[*--s2];
}
char* strdup ( const char *  p)

Duplicates a C string, returns NULL if failed, or passed NULL.

Definition at line 122 of file strings.c.

{
       char   *r;

       r = (char *) malloc( strlen( p ) + 1 );
       if ( r != NULL ) {
              strcpy( r, p );
       }

       return( r );
}
int strncasecmp ( const char *  s1,
const char *  s2,
const long  n 
)

Definition at line 106 of file strings.c.

{
       register char *cm = charmap;
       register long remain = n;
       
       while (--remain >= 0 && cm[*s1] == cm[*s2++])
              if (*s1++ == '\0')
                     return(0);
       return remain < 0 ? 0 : cm[*s1] - cm[*--s2];
}

Here is the caller graph for this function:


Variable Documentation

char charmap[] [static]

Definition at line 56 of file strings.c.