1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * 3*0Sstevel@tonic-gate * Portions Copyright %G% Sun Microsystems, Inc. 4*0Sstevel@tonic-gate * All Rights Reserved 5*0Sstevel@tonic-gate * 6*0Sstevel@tonic-gate */ 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 9*0Sstevel@tonic-gate 10*0Sstevel@tonic-gate #include <stdio.h> 11*0Sstevel@tonic-gate #include <string.h> 12*0Sstevel@tonic-gate #include <ctype.h> 13*0Sstevel@tonic-gate #include "lber.h" 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate /* 16*0Sstevel@tonic-gate * Print arbitrary stuff, for debugging. 17*0Sstevel@tonic-gate */ 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate #ifdef LDAP_DEBUG 20*0Sstevel@tonic-gate 21*0Sstevel@tonic-gate #ifndef NO_USERINTERFACE 22*0Sstevel@tonic-gate #define BPLEN 48 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gate void 25*0Sstevel@tonic-gate lber_bprint( char *data, int len ) 26*0Sstevel@tonic-gate { 27*0Sstevel@tonic-gate static char hexdig[] = "0123456789abcdef"; 28*0Sstevel@tonic-gate char out[ BPLEN ]; 29*0Sstevel@tonic-gate int i = 0; 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate (void) memset( out, 0, BPLEN ); 32*0Sstevel@tonic-gate for ( ;; ) { 33*0Sstevel@tonic-gate if ( len < 1 ) { 34*0Sstevel@tonic-gate (void) fprintf( stderr, "\t%s\n", ( i == 0 ) ? catgets(slapdcat, 1, 72, "(end)") : out ); 35*0Sstevel@tonic-gate break; 36*0Sstevel@tonic-gate } 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate #ifndef HEX 39*0Sstevel@tonic-gate if ( isgraph( (unsigned char)*data )) { 40*0Sstevel@tonic-gate out[ i ] = ' '; 41*0Sstevel@tonic-gate out[ i+1 ] = *data; 42*0Sstevel@tonic-gate } else { 43*0Sstevel@tonic-gate #endif 44*0Sstevel@tonic-gate out[ i ] = hexdig[ ( *data & 0xf0 ) >> 4 ]; 45*0Sstevel@tonic-gate out[ i+1 ] = hexdig[ *data & 0x0f ]; 46*0Sstevel@tonic-gate #ifndef HEX 47*0Sstevel@tonic-gate } 48*0Sstevel@tonic-gate #endif 49*0Sstevel@tonic-gate i += 2; 50*0Sstevel@tonic-gate len--; 51*0Sstevel@tonic-gate data++; 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate if ( i > BPLEN - 2 ) { 54*0Sstevel@tonic-gate (void) fprintf( stderr, "\t%s\n", out ); 55*0Sstevel@tonic-gate (void) memset( out, 0, BPLEN ); 56*0Sstevel@tonic-gate i = 0; 57*0Sstevel@tonic-gate continue; 58*0Sstevel@tonic-gate } 59*0Sstevel@tonic-gate out[ i++ ] = ' '; 60*0Sstevel@tonic-gate } 61*0Sstevel@tonic-gate } 62*0Sstevel@tonic-gate #else /* NO_USERINTERFACE */ 63*0Sstevel@tonic-gate void 64*0Sstevel@tonic-gate lber_bprint( char *data, int len ) 65*0Sstevel@tonic-gate { 66*0Sstevel@tonic-gate } 67*0Sstevel@tonic-gate #endif /* NO_USERINTERFACE */ 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate #endif 70