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