xref: /onnv-gate/usr/src/cmd/ldap/common/idtest.c (revision 3857:21b9b714e4ab)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  *
3*3857Sstevel  * Portions Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
4*3857Sstevel  * Use is subject to license terms.
50Sstevel@tonic-gate  *
60Sstevel@tonic-gate  */
70Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
80Sstevel@tonic-gate /* idtest.c - ber decoding test program using isode libraries */
90Sstevel@tonic-gate /*
100Sstevel@tonic-gate  * Copyright (c) 1990 Regents of the University of Michigan.
110Sstevel@tonic-gate  * All rights reserved.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * Redistribution and use in source and binary forms are permitted
140Sstevel@tonic-gate  * provided that this notice is preserved and that due credit is given
150Sstevel@tonic-gate  * to the University of Michigan at Ann Arbor. The name of the University
160Sstevel@tonic-gate  * may not be used to endorse or promote products derived from this
170Sstevel@tonic-gate  * software without specific prior written permission. This software
180Sstevel@tonic-gate  * is provided ``as is'' without express or implied warranty.
190Sstevel@tonic-gate  */
200Sstevel@tonic-gate 
210Sstevel@tonic-gate #include <stdio.h>
220Sstevel@tonic-gate #include <psap.h>
230Sstevel@tonic-gate #include <quipu/attr.h>
240Sstevel@tonic-gate 
usage(char * name)250Sstevel@tonic-gate static usage( char *name )
260Sstevel@tonic-gate {
270Sstevel@tonic-gate 	fprintf( stderr, "usage: %s\n", name );
280Sstevel@tonic-gate }
290Sstevel@tonic-gate 
main(int argc,char ** argv)300Sstevel@tonic-gate main( int argc, char **argv )
310Sstevel@tonic-gate {
320Sstevel@tonic-gate 	PE	pe;
330Sstevel@tonic-gate 	PS	psin, psout, pserr;
340Sstevel@tonic-gate 
350Sstevel@tonic-gate 	/* read the pe from standard in */
360Sstevel@tonic-gate 	if ( (psin = ps_alloc( std_open )) == NULLPS ) {
370Sstevel@tonic-gate 		perror( "ps_alloc" );
380Sstevel@tonic-gate 		exit( 1 );
390Sstevel@tonic-gate 	}
400Sstevel@tonic-gate 	if ( std_setup( psin, stdin ) == NOTOK ) {
410Sstevel@tonic-gate 		perror( "std_setup" );
420Sstevel@tonic-gate 		exit( 1 );
430Sstevel@tonic-gate 	}
440Sstevel@tonic-gate 	/* write the pe to standard out */
450Sstevel@tonic-gate 	if ( (psout = ps_alloc( std_open )) == NULLPS ) {
460Sstevel@tonic-gate 		perror( "ps_alloc" );
470Sstevel@tonic-gate 		exit( 1 );
480Sstevel@tonic-gate 	}
490Sstevel@tonic-gate 	if ( std_setup( psout, stdout ) == NOTOK ) {
500Sstevel@tonic-gate 		perror( "std_setup" );
510Sstevel@tonic-gate 		exit( 1 );
520Sstevel@tonic-gate 	}
530Sstevel@tonic-gate 	/* pretty print it to standard error */
540Sstevel@tonic-gate 	if ( (pserr = ps_alloc( std_open )) == NULLPS ) {
550Sstevel@tonic-gate 		perror( "ps_alloc" );
560Sstevel@tonic-gate 		exit( 1 );
570Sstevel@tonic-gate 	}
580Sstevel@tonic-gate 	if ( std_setup( pserr, stderr ) == NOTOK ) {
590Sstevel@tonic-gate 		perror( "std_setup" );
600Sstevel@tonic-gate 		exit( 1 );
610Sstevel@tonic-gate 	}
620Sstevel@tonic-gate 
630Sstevel@tonic-gate 	while ( (pe = ps2pe( psin )) != NULLPE ) {
640Sstevel@tonic-gate 		pe2pl( pserr, pe );
650Sstevel@tonic-gate 		pe2ps( psout, pe );
660Sstevel@tonic-gate 	}
670Sstevel@tonic-gate 
680Sstevel@tonic-gate 	exit( 0 );
690Sstevel@tonic-gate }
70