From: Kurt Zeilenga Date: Sat, 22 Jan 2000 21:03:21 +0000 (+0000) Subject: We'll need ldap_utf8_strpbrk() as well. X-Git-Tag: UCDATA_2_4~16 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=aa934d0666cac55d7a07ae458511a9eb82cea3b4;p=openldap We'll need ldap_utf8_strpbrk() as well. --- diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index e161a6d52b..974d0dcf90 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -526,6 +526,7 @@ LIBLDAP_F (int) ldap_utf8_isspace( const char * ); LIBLDAP_F (ber_len_t) ldap_utf8_strcspn( const char* str, const char *set); LIBLDAP_F (ber_len_t) ldap_utf8_strspn( const char* str, const char *set); +LIBLDAP_F (char *) ldap_utf8_strpbrk( const char* str, const char *set); LIBLDAP_F (char*) ldap_utf8_strtok( char* sp, const char* sep, char **last); LDAP_END_DECL diff --git a/libraries/libldap/utf-8.c b/libraries/libldap/utf-8.c index 5eb46ce325..2069b591f3 100644 --- a/libraries/libldap/utf-8.c +++ b/libraries/libldap/utf-8.c @@ -380,6 +380,30 @@ ber_len_t (ldap_utf8_strspn)( const char *str, const char *set ) return cstr - str; } +char *(ldap_utf8_strpbrk)( const char *str, const char *set ) +{ + int len; + const char *cstr; + + for( cstr = str; *cstr != '\0'; cstr += len ) { + const char *cset; + + for( cset = set; ; cset += len ) { + if( ldap_utf8_to_ucs4( cstr ) == ldap_utf8_to_ucs4( cset ) ) { + return cstr; + } + + len = ldap_utf8_charlen(cset); + if( !len ) break; + } + + len = ldap_utf8_charlen(cstr); + if( !len ) break; + } + + return NULL; +} + char *(ldap_utf8_strtok)(char *str, const char *sep, char **last) { char *begin;