1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  *
3*0Sstevel@tonic-gate  * Portions Copyright %G% Sun Microsystems, Inc. All Rights Reserved
4*0Sstevel@tonic-gate  *
5*0Sstevel@tonic-gate  */
6*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
7*0Sstevel@tonic-gate /* idtest.c - ber decoding test program using isode libraries */
8*0Sstevel@tonic-gate /*
9*0Sstevel@tonic-gate  * Copyright (c) 1990 Regents of the University of Michigan.
10*0Sstevel@tonic-gate  * All rights reserved.
11*0Sstevel@tonic-gate  *
12*0Sstevel@tonic-gate  * Redistribution and use in source and binary forms are permitted
13*0Sstevel@tonic-gate  * provided that this notice is preserved and that due credit is given
14*0Sstevel@tonic-gate  * to the University of Michigan at Ann Arbor. The name of the University
15*0Sstevel@tonic-gate  * may not be used to endorse or promote products derived from this
16*0Sstevel@tonic-gate  * software without specific prior written permission. This software
17*0Sstevel@tonic-gate  * is provided ``as is'' without express or implied warranty.
18*0Sstevel@tonic-gate  */
19*0Sstevel@tonic-gate 
20*0Sstevel@tonic-gate #include <stdio.h>
21*0Sstevel@tonic-gate #include <psap.h>
22*0Sstevel@tonic-gate #include <quipu/attr.h>
23*0Sstevel@tonic-gate 
24*0Sstevel@tonic-gate static usage( char *name )
25*0Sstevel@tonic-gate {
26*0Sstevel@tonic-gate 	fprintf( stderr, "usage: %s\n", name );
27*0Sstevel@tonic-gate }
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate main( int argc, char **argv )
30*0Sstevel@tonic-gate {
31*0Sstevel@tonic-gate 	PE	pe;
32*0Sstevel@tonic-gate 	PS	psin, psout, pserr;
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate 	/* read the pe from standard in */
35*0Sstevel@tonic-gate 	if ( (psin = ps_alloc( std_open )) == NULLPS ) {
36*0Sstevel@tonic-gate 		perror( "ps_alloc" );
37*0Sstevel@tonic-gate 		exit( 1 );
38*0Sstevel@tonic-gate 	}
39*0Sstevel@tonic-gate 	if ( std_setup( psin, stdin ) == NOTOK ) {
40*0Sstevel@tonic-gate 		perror( "std_setup" );
41*0Sstevel@tonic-gate 		exit( 1 );
42*0Sstevel@tonic-gate 	}
43*0Sstevel@tonic-gate 	/* write the pe to standard out */
44*0Sstevel@tonic-gate 	if ( (psout = ps_alloc( std_open )) == NULLPS ) {
45*0Sstevel@tonic-gate 		perror( "ps_alloc" );
46*0Sstevel@tonic-gate 		exit( 1 );
47*0Sstevel@tonic-gate 	}
48*0Sstevel@tonic-gate 	if ( std_setup( psout, stdout ) == NOTOK ) {
49*0Sstevel@tonic-gate 		perror( "std_setup" );
50*0Sstevel@tonic-gate 		exit( 1 );
51*0Sstevel@tonic-gate 	}
52*0Sstevel@tonic-gate 	/* pretty print it to standard error */
53*0Sstevel@tonic-gate 	if ( (pserr = ps_alloc( std_open )) == NULLPS ) {
54*0Sstevel@tonic-gate 		perror( "ps_alloc" );
55*0Sstevel@tonic-gate 		exit( 1 );
56*0Sstevel@tonic-gate 	}
57*0Sstevel@tonic-gate 	if ( std_setup( pserr, stderr ) == NOTOK ) {
58*0Sstevel@tonic-gate 		perror( "std_setup" );
59*0Sstevel@tonic-gate 		exit( 1 );
60*0Sstevel@tonic-gate 	}
61*0Sstevel@tonic-gate 
62*0Sstevel@tonic-gate 	while ( (pe = ps2pe( psin )) != NULLPE ) {
63*0Sstevel@tonic-gate 		pe2pl( pserr, pe );
64*0Sstevel@tonic-gate 		pe2ps( psout, pe );
65*0Sstevel@tonic-gate 	}
66*0Sstevel@tonic-gate 
67*0Sstevel@tonic-gate 	exit( 0 );
68*0Sstevel@tonic-gate }
69