From 34c945b86d995d762826f90b24f51189ba1d8af3 Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Tue, 27 Oct 1998 07:50:07 +0000
Subject: [PATCH] added ber_print_error() and renamed lber_bprint into ber_
 namespace.

---
 doc/man/man1/ldapsearch.1  |  2 +-
 include/lber.h             |  4 +++-
 libraries/liblber/bprint.c | 19 +++++++++++++++----
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/doc/man/man1/ldapsearch.1 b/doc/man/man1/ldapsearch.1
index 84facf394d..f1b5d43a55 100644
--- a/doc/man/man1/ldapsearch.1
+++ b/doc/man/man1/ldapsearch.1
@@ -164,7 +164,7 @@ base object for the search.  The default is to never dereference aliases.
 wait at most \fItimelimit\fP seconds for a search to complete.
 .TP
 .B \-z sizelimit
-retrieve at most \fIsizelimit\fP seconds for a search to complete.
+retrieve at most \fIsizelimit\fP entries for a search.
 .SH OUTPUT FORMAT
 If one or more entries are found, each entry is written to standard output
 in the form:
diff --git a/include/lber.h b/include/lber.h
index 45e9681cca..e2745a1679 100644
--- a/include/lber.h
+++ b/include/lber.h
@@ -97,7 +97,9 @@ extern int lber_debug;
 /*
  * in bprint.c:
  */
-LDAP_F void lber_bprint LDAP_P(( char *data, int len ));
+LDAP_F void ber_print_error LDAP_P(( char *data ));
+LDAP_F void ber_bprint LDAP_P(( char *data, int len ));
+#define lber_bprint(d,l)	ber_bprint((d),(l))
 
 /*
  * in decode.c:
diff --git a/libraries/liblber/bprint.c b/libraries/liblber/bprint.c
index 93f759fbdf..0b380e62ca 100644
--- a/libraries/liblber/bprint.c
+++ b/libraries/liblber/bprint.c
@@ -1,9 +1,9 @@
 
 #include "portable.h"
 
-#if defined( LDAP_DEBUG ) && defined( LDAP_LIBUI )
 #include <stdio.h>
 
+#if defined( LDAP_DEBUG ) && defined( LDAP_LIBUI )
 #include <ac/ctype.h>
 #include <ac/string.h>
 #endif /* LDAP_DEBUG && LDAP_LIBUI  */
@@ -11,12 +11,21 @@
 #include "lber-int.h"
 
 /*
- * Print arbitrary stuff, for debugging.
+ * Print stuff
  */
+void
+ber_print_error( char *data)
+{
+	fputs( data, stderr );
+	fflush( stderr );
+}
 
+/*
+ * Print arbitrary stuff, for debugging.
+ */
 
 void
-lber_bprint( char *data, int len )
+ber_bprint( char *data, int len )
 {
 #if defined( LDAP_DEBUG ) && defined( LDAP_LIBUI )
 #define BPLEN	48
@@ -48,7 +57,9 @@ lber_bprint( char *data, int len )
 	data++;
 
 	if ( i > BPLEN - 2 ) {
-	    fprintf( stderr, "\t%s\n", out );
+		char data[128 + BPLEN];
+	    sprintf( data, "\t%s\n", out );
+		ber_print_error(data);
 	    memset( out, 0, BPLEN );
 	    i = 0;
 	    continue;
-- 
GitLab