X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fstring.c;h=ee275baec66cee7c47a0806484fb8e1ebde1e1ec;hb=fe86a81e251bda73f04841f765b2a93ac0354396;hp=9952f8b7bb08924f89fb90795cffe9bf1f152151;hpb=f90277edc551faa43059bf17c707ad7c1d1b91d6;p=openldap diff --git a/libraries/libldap/string.c b/libraries/libldap/string.c index 9952f8b7bb..ee275baec6 100644 --- a/libraries/libldap/string.c +++ b/libraries/libldap/string.c @@ -1,13 +1,20 @@ +/* $OpenLDAP$ */ /* - * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ +/* + * Locale-specific 1-byte character versions + * See utf-8.c for UTF-8 versions + */ + #include "portable.h" -#include +#include #include #include +#include #include "ldap-int.h" @@ -91,15 +98,31 @@ char *(ldap_pvt_strtok)( char *str, const char *delim, char **pos ) } char * -(ldap_pvt_strdup)( const char *s ) +ldap_pvt_str2upper( char *str ) +{ + char *s; + + /* to upper */ + if ( str ) { + for ( s = str; *s; s++ ) { + *s = TOUPPER( (unsigned char) *s ); + } + } + + return( str ); +} + +char * +ldap_pvt_str2lower( char *str ) { - char *p; - size_t len = strlen( s ) + 1; + char *s; - if ( (p = (char *) malloc( len )) == NULL ) { - return( NULL ); + /* to lower */ + if ( str ) { + for ( s = str; *s; s++ ) { + *s = TOLOWER( (unsigned char) *s ); + } } - memcpy( p, s, len ); - return( p ); + return( str ); }