]> git.sur5r.net Git - openldap/commitdiff
split lines in additional info (ITS#4543)
authorPierangelo Masarati <ando@openldap.org>
Sat, 13 May 2006 00:46:06 +0000 (00:46 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 13 May 2006 00:46:06 +0000 (00:46 +0000)
clients/tools/ldapsearch.c

index 3fb57bffad9ce82cd1ac803fea10c884f8a48926..04840c421881d098d885c54ea045f6f710238aa3 100644 (file)
@@ -1523,12 +1523,27 @@ static int print_result(
 
        if( text ) {
                if( *text ) {
-               if( !ldif ) {
-                       tool_write_ldif( LDIF_PUT_TEXT, "text",
-                               text, strlen(text) );
-               } else {
-                       fprintf( stderr, _("Additional information: %s\n"), text );
-               }
+                       if( !ldif ) {
+                               if ( err == LDAP_PARTIAL_RESULTS ) {
+                                       char    *line;
+
+                                       for ( line = text; line != NULL; ) {
+                                               char    *next = strchr( line, '\n' );
+
+                                               tool_write_ldif( LDIF_PUT_TEXT,
+                                                       "text", line,
+                                                       next ? next - line : strlen( line ) );
+
+                                               line = next ? next + 1 : NULL;
+                                       }
+
+                               } else {
+                                       tool_write_ldif( LDIF_PUT_TEXT, "text",
+                                               text, strlen(text) );
+                               }
+                       } else {
+                               fprintf( stderr, _("Additional information: %s\n"), text );
+                       }
                }
 
                ber_memfree( text );