]> git.sur5r.net Git - openldap/commitdiff
We'll need ldap_utf8_strpbrk() as well.
authorKurt Zeilenga <kurt@openldap.org>
Sat, 22 Jan 2000 21:03:21 +0000 (21:03 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 22 Jan 2000 21:03:21 +0000 (21:03 +0000)
libraries/libldap/ldap-int.h
libraries/libldap/utf-8.c

index e161a6d52b53a9a405900a7ddca7dc2fa44a76de..974d0dcf904777e6ef1606f4b7f6b7f6376d3c6d 100644 (file)
@@ -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
index 5eb46ce325fb75ac2feae9750259293a7b8ad42c..2069b591f3088cedac60474bed65c5f52a837042 100644 (file)
@@ -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;