]> git.sur5r.net Git - openldap/commitdiff
minor cleanup
authorPierangelo Masarati <ando@openldap.org>
Fri, 6 Jan 2006 16:20:24 +0000 (16:20 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 6 Jan 2006 16:20:24 +0000 (16:20 +0000)
clients/tools/common.c
clients/tools/common.h
clients/tools/ldapsearch.c

index 4886f76e30f87956a0b7c4a78806be2e7b19fa3a..ceaf0dfe7c5b450c457a078c904f442b374d27b8 100644 (file)
@@ -1511,3 +1511,34 @@ tool_write_ldif( int type, char *name, char *value, ber_len_t vallen )
        return( 0 );
 }
 
+int
+tool_is_oid( const char *s )
+{
+       int             first = 1;
+
+       if ( !isdigit( s[ 0 ] ) ) {
+               return 0;
+       }
+
+       for ( ; s[ 0 ]; s++ ) {
+               if ( s[ 0 ] == '.' ) {
+                       if ( s[ 1 ] == '\0' ) {
+                               return 0;
+                       }
+                       first = 1;
+                       continue;
+               }
+
+               if ( !isdigit( s[ 0 ] ) ) {
+                       return 0;
+               }
+
+               if ( first == 1 && s[ 0 ] == '0' && s[ 1 ] != '.' ) {
+                       return 0;
+               }
+               first = 0;
+       }
+
+       return 1;
+}
+
index 1b56b3e23f0287da3dff8973e5618a1cb4e205b0..b78c28cd2149b9992e8b489af619ead0ae8c3693 100644 (file)
@@ -93,6 +93,7 @@ void tool_perror LDAP_P((
        char **refs ));
 void tool_print_ctrls LDAP_P(( LDAP *ld, LDAPControl **ctrls ));
 int tool_write_ldif LDAP_P(( int type, char *name, char *value, ber_len_t vallen ));
+int tool_is_oid LDAP_P(( const char *s ));
 
 
 LDAP_END_DECL
index c65ddafc93860d7accf9059c4f8c87f029c9dad9..c75b22dfcd21808b9afa1e38cfd4d76e49824628 100644 (file)
@@ -237,37 +237,6 @@ ctrl_add( void )
        return 0;
 }
 
-static int
-is_oid( const char *s )
-{
-       int             first = 1;
-
-       if ( !isdigit( s[ 0 ] ) ) {
-               return 0;
-       }
-
-       for ( ; s[ 0 ]; s++ ) {
-               if ( s[ 0 ] == '.' ) {
-                       if ( s[ 1 ] == '\0' ) {
-                               return 0;
-                       }
-                       first = 1;
-                       continue;
-               }
-
-               if ( !isdigit( s[ 0 ] ) ) {
-                       return 0;
-               }
-
-               if ( first == 1 && s[ 0 ] == '0' && s[ 1 ] != '.' ) {
-                       return 0;
-               }
-               first = 0;
-       }
-
-       return 1;
-}
-
 static int parse_page_control(
        LDAP *ld,
        LDAPMessage *result,
@@ -498,7 +467,7 @@ handle_private_option( int i )
                        }
                        if ( crit ) ldapsync *= -1;
 
-               } else if ( is_oid( control ) ) {
+               } else if ( tool_is_oid( control ) ) {
                        if ( ctrl_add() ) {
                                exit( EXIT_FAILURE );
                        }