]> git.sur5r.net Git - openldap/blob - libraries/liblber/idtest.c
meaningful message in case max_incomingis hit
[openldap] / libraries / liblber / idtest.c
1 /* idtest.c - ber decoding test program using isode libraries */
2 /* $OpenLDAP$ */
3 /*
4  * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
5  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6  */
7 /* Portions
8  * Copyright (c) 1990 Regents of the University of Michigan.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms are permitted
12  * provided that this notice is preserved and that due credit is given
13  * to the University of Michigan at Ann Arbor. The name of the University
14  * may not be used to endorse or promote products derived from this
15  * software without specific prior written permission. This software
16  * is provided ``as is'' without express or implied warranty.
17  */
18
19 #include "portable.h"
20
21 #include <stdio.h>
22
23 #include <ac/stdlib.h>
24
25 #ifdef HAVE_PSAP_H
26 #include <psap.h>
27 #include <quipu/attr.h>
28 #endif
29
30 int
31 main( int argc, char **argv )
32 {
33 #ifdef HAVE_PSAP_H
34         PE      pe;
35         PS      psin, psout, pserr;
36
37         /* read the pe from standard in */
38         if ( (psin = ps_alloc( std_open )) == NULLPS ) {
39                 perror( "ps_alloc" );
40                 exit( EXIT_FAILURE );
41         }
42         if ( std_setup( psin, stdin ) == NOTOK ) {
43                 perror( "std_setup" );
44                 exit( EXIT_FAILURE );
45         }
46         /* write the pe to standard out */
47         if ( (psout = ps_alloc( std_open )) == NULLPS ) {
48                 perror( "ps_alloc" );
49                 exit( EXIT_FAILURE );
50         }
51         if ( std_setup( psout, stdout ) == NOTOK ) {
52                 perror( "std_setup" );
53                 exit( EXIT_FAILURE );
54         }
55         /* pretty print it to standard error */
56         if ( (pserr = ps_alloc( std_open )) == NULLPS ) {
57                 perror( "ps_alloc" );
58                 exit( EXIT_FAILURE );
59         }
60         if ( std_setup( pserr, stderr ) == NOTOK ) {
61                 perror( "std_setup" );
62                 exit( EXIT_FAILURE );
63         }
64
65         while ( (pe = ps2pe( psin )) != NULLPE ) {
66                 pe2pl( pserr, pe );
67                 pe2ps( psout, pe );
68         }
69
70         exit( EXIT_SUCCESS );
71 #else
72         fprintf(stderr, "requires ISODE X.500 distribution.\n");
73         return( EXIT_FAILURE );
74 #endif
75 }