No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / openldap / dist / libraries / liblber / idtest.c
blob33764c8cdef657b88db495a48ea52074b095cb05
1 /* idtest.c - ber decoding test program using isode libraries */
2 /* $OpenLDAP: pkg/ldap/libraries/liblber/idtest.c,v 1.18.2.3 2008/02/11 23:26:41 kurt Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2008 The OpenLDAP Foundation.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
10 * Public License.
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
16 /* Portions Copyright (c) 1990 Regents of the University of Michigan.
17 * All rights reserved.
19 * Redistribution and use in source and binary forms are permitted
20 * provided that this notice is preserved and that due credit is given
21 * to the University of Michigan at Ann Arbor. The name of the University
22 * may not be used to endorse or promote products derived from this
23 * software without specific prior written permission. This software
24 * is provided ``as is'' without express or implied warranty.
26 /* ACKNOWLEDGEMENTS:
27 * This work was originally developed by the University of Michigan
28 * (as part of U-MICH LDAP).
31 #include "portable.h"
33 #include <stdio.h>
35 #include <ac/stdlib.h>
37 #ifdef HAVE_PSAP_H
38 #include <psap.h>
39 #include <quipu/attr.h>
40 #endif
42 int
43 main( int argc, char **argv )
45 #ifdef HAVE_PSAP_H
46 PE pe;
47 PS psin, psout, pserr;
49 /* read the pe from standard in */
50 if ( (psin = ps_alloc( std_open )) == NULLPS ) {
51 perror( "ps_alloc" );
52 exit( EXIT_FAILURE );
54 if ( std_setup( psin, stdin ) == NOTOK ) {
55 perror( "std_setup" );
56 exit( EXIT_FAILURE );
58 /* write the pe to standard out */
59 if ( (psout = ps_alloc( std_open )) == NULLPS ) {
60 perror( "ps_alloc" );
61 exit( EXIT_FAILURE );
63 if ( std_setup( psout, stdout ) == NOTOK ) {
64 perror( "std_setup" );
65 exit( EXIT_FAILURE );
67 /* pretty print it to standard error */
68 if ( (pserr = ps_alloc( std_open )) == NULLPS ) {
69 perror( "ps_alloc" );
70 exit( EXIT_FAILURE );
72 if ( std_setup( pserr, stderr ) == NOTOK ) {
73 perror( "std_setup" );
74 exit( EXIT_FAILURE );
77 while ( (pe = ps2pe( psin )) != NULLPE ) {
78 pe2pl( pserr, pe );
79 pe2ps( psout, pe );
82 exit( EXIT_SUCCESS );
83 #else
84 fprintf(stderr, "requires ISODE X.500 distribution.\n");
85 return( EXIT_FAILURE );
86 #endif