]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/string.c
Rework SASL command line arguments. Default is now to authenticate
[openldap] / libraries / libldap / string.c
index a0877bb68342b3d290a63d7ff2822dbd0552562d..df8069ccaabe80c4e9da084decf7e1db1f711032 100644 (file)
@@ -1,13 +1,20 @@
+/* $OpenLDAP$ */
 /*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2000 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 <stdlib.h>
+#include <ac/stdlib.h>
 #include <ac/string.h>
 #include <ac/time.h>
+#include <ac/ctype.h>
 
 #include "ldap-int.h"
 
@@ -58,9 +65,6 @@ static char *(int_strpbrk)( const char *str, const char *accept )
 
 char *(ldap_pvt_strtok)( char *str, const char *delim, char **pos )
 {
-#if defined( HAVE_STRTOK_R ) || defined( HAVE_REENTRANT_FUNCTIONS )
-       return strtok_r(str, delim, pos);
-#else
        char *p;
 
        if (pos==NULL) {
@@ -91,19 +95,30 @@ char *(ldap_pvt_strtok)( char *str, const char *delim, char **pos )
        }
 
        return str;
-#endif
 }
 
 char *
-(ldap_pvt_strdup)( const char *s )
+ldap_pvt_str2upper( char *str )
+{
+       char    *s;
+
+       /* to upper */
+       for ( s = str; *s; s++ ) {
+               *s = TOUPPER( (unsigned char) *s );
+       }
+
+       return( str );
+}
+
+char *
+ldap_pvt_str2lower( char *str )
 {
-       char    *p;
-       int     len = strlen( s ) + 1;
+       char    *s;
 
-       if ( (p = (char *) malloc( len )) == NULL ) {
-               return( (char *)0 );
+       /* to lower */
+       for ( s = str; *s; s++ ) {
+               *s = TOLOWER( (unsigned char) *s );
        }
 
-       memcpy( p, s, len );
-       return( p );
+       return( str );
 }