From: Pierangelo Masarati Date: Sat, 13 May 2006 00:46:06 +0000 (+0000) Subject: split lines in additional info (ITS#4543) X-Git-Tag: OPENLDAP_REL_ENG_2_4_1ALPHA~2^2~27 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d0fc998454cadd66db66cb1002a548af2664fe5e;p=openldap split lines in additional info (ITS#4543) --- diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 3fb57bffad..04840c4218 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -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 );