]> git.sur5r.net Git - openldap/blob - libraries/liblber/idtest.c
Clean up sh commands in Makefiles (incorrect use of ';').
[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 #define DISABLE_BRIDGE
15 #include "portable.h"
16
17 #include <stdio.h>
18 #include <psap.h>
19 #include <quipu/attr.h>
20
21 static usage( char *name )
22 {
23         fprintf( stderr, "usage: %s\n", name );
24 }
25
26 main( int argc, char **argv )
27 {
28         PE      pe;
29         PS      psin, psout, pserr;
30
31         /* read the pe from standard in */
32         if ( (psin = ps_alloc( std_open )) == NULLPS ) {
33                 perror( "ps_alloc" );
34                 exit( 1 );
35         }
36         if ( std_setup( psin, stdin ) == NOTOK ) {
37                 perror( "std_setup" );
38                 exit( 1 );
39         }
40         /* write the pe to standard out */
41         if ( (psout = ps_alloc( std_open )) == NULLPS ) {
42                 perror( "ps_alloc" );
43                 exit( 1 );
44         }
45         if ( std_setup( psout, stdout ) == NOTOK ) {
46                 perror( "std_setup" );
47                 exit( 1 );
48         }
49         /* pretty print it to standard error */
50         if ( (pserr = ps_alloc( std_open )) == NULLPS ) {
51                 perror( "ps_alloc" );
52                 exit( 1 );
53         }
54         if ( std_setup( pserr, stderr ) == NOTOK ) {
55                 perror( "std_setup" );
56                 exit( 1 );
57         }
58
59         while ( (pe = ps2pe( psin )) != NULLPE ) {
60                 pe2pl( pserr, pe );
61                 pe2ps( psout, pe );
62         }
63
64         exit( 0 );
65 }