Back to index

openldap  2.4.31
Functions
string.c File Reference
#include "portable.h"
#include <ac/stdlib.h>
#include <ac/string.h>
#include <ac/time.h>
#include <ac/ctype.h>
#include "ldap-int.h"

Go to the source code of this file.

Functions

static int int_strspn (const char *str, const char *delim)
static char *() int_strpbrk (const char *str, const char *accept)
char *() ldap_pvt_strtok (char *str, const char *delim, char **pos)
char * ldap_pvt_str2upper (char *str)
struct bervalldap_pvt_str2upperbv (char *str, struct berval *bv)
char * ldap_pvt_str2lower (char *str)
struct bervalldap_pvt_str2lowerbv (char *str, struct berval *bv)

Function Documentation

static char*() int_strpbrk ( const char *  str,
const char *  accept 
) [static]

Definition at line 59 of file string.c.

{
       const char *p;

       for( ; (*str) ; str++ ) {
              for( p=accept; (*p) ; p++) {
                     if (*str==*p) {
                            return str;
                     }
              }
       }

       return NULL;
}

Here is the caller graph for this function:

static int int_strspn ( const char *  str,
const char *  delim 
) [static]

Definition at line 34 of file string.c.

{
       int pos;
       const char *p=delim;

       for( pos=0; (*str) ; pos++,str++) {
              if (*str!=*p) {
                     for( p=delim; (*p) ; p++ ) {
                            if (*str==*p) {
                                   break;
                            }
                     }
              }

              if (*p=='\0') {
                     return pos;
              }
       }
       return pos;
}

Here is the caller graph for this function:

char* ldap_pvt_str2lower ( char *  str)

Definition at line 145 of file string.c.

{
       char    *s;

       /* to lower */
       if ( str ) {
              for ( s = str; *s; s++ ) {
                     *s = TOLOWER( (unsigned char) *s );
              }
       }

       return( str );
}

Here is the caller graph for this function:

struct berval* ldap_pvt_str2lowerbv ( char *  str,
struct berval bv 
) [read]

Definition at line 160 of file string.c.

{
       char    *s = NULL;

       assert( bv != NULL );

       /* to lower */
       if ( str ) {
              for ( s = str; *s; s++ ) {
                     *s = TOLOWER( (unsigned char) *s );
              }
       }

       bv->bv_val = str;
       bv->bv_len = (ber_len_t)(s - str);

       return( bv );
}
char* ldap_pvt_str2upper ( char *  str)

Definition at line 110 of file string.c.

{
       char    *s;

       /* to upper */
       if ( str ) {
              for ( s = str; *s; s++ ) {
                     *s = TOUPPER( (unsigned char) *s );
              }
       }

       return( str );
}

Here is the caller graph for this function:

struct berval* ldap_pvt_str2upperbv ( char *  str,
struct berval bv 
) [read]

Definition at line 125 of file string.c.

{
       char    *s = NULL;

       assert( bv != NULL );

       /* to upper */
       if ( str ) {
              for ( s = str; *s; s++ ) {
                     *s = TOUPPER( (unsigned char) *s );
              }
       }

       bv->bv_val = str;
       bv->bv_len = (ber_len_t)(s - str);
       
       return( bv );
}
char*() ldap_pvt_strtok ( char *  str,
const char *  delim,
char **  pos 
)

Definition at line 75 of file string.c.

{
       char *p;

       if (pos==NULL) {
              return NULL;
       }

       if (str==NULL) {
              if (*pos==NULL) {
                     return NULL;
              }

              str=*pos;
       }

       /* skip any initial delimiters */
       str += int_strspn( str, delim );
       if (*str == '\0') {
              return NULL;
       }

       p = int_strpbrk( str, delim );
       if (p==NULL) {
              *pos = NULL;

       } else {
              *p ='\0';
              *pos = p+1;
       }

       return str;
}

Here is the call graph for this function:

Here is the caller graph for this function: