From aa934d0666cac55d7a07ae458511a9eb82cea3b4 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 22 Jan 2000 21:03:21 +0000 Subject: [PATCH] We'll need ldap_utf8_strpbrk() as well. --- libraries/libldap/ldap-int.h | 1 + libraries/libldap/utf-8.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) 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; -- 2.39.5