1998-08-09 08:43:13 +08:00
|
|
|
/* idtest.c - ber decoding test program using isode libraries */
|
1999-09-09 03:06:24 +08:00
|
|
|
/* $OpenLDAP$ */
|
2003-11-26 07:17:08 +08:00
|
|
|
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
*
|
2004-01-02 03:15:16 +08:00
|
|
|
* Copyright 1998-2004 The OpenLDAP Foundation.
|
2003-11-26 07:17:08 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted only as authorized by the OpenLDAP
|
|
|
|
* Public License.
|
|
|
|
*
|
|
|
|
* A copy of this license is available in the file LICENSE in the
|
|
|
|
* top-level directory of the distribution or, alternatively, at
|
|
|
|
* <http://www.OpenLDAP.org/license.html>.
|
1998-12-29 04:38:04 +08:00
|
|
|
*/
|
2003-11-26 07:17:08 +08:00
|
|
|
/* Portions Copyright (c) 1990 Regents of the University of Michigan.
|
1998-08-09 08:43:13 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms are permitted
|
|
|
|
* provided that this notice is preserved and that due credit is given
|
|
|
|
* to the University of Michigan at Ann Arbor. The name of the University
|
|
|
|
* may not be used to endorse or promote products derived from this
|
|
|
|
* software without specific prior written permission. This software
|
|
|
|
* is provided ``as is'' without express or implied warranty.
|
|
|
|
*/
|
2003-11-27 06:51:15 +08:00
|
|
|
/* ACKNOWLEDGEMENTS:
|
|
|
|
* This work was originally developed by the University of Michigan
|
|
|
|
* (as part of U-MICH LDAP).
|
|
|
|
*/
|
1998-08-09 08:43:13 +08:00
|
|
|
|
1998-10-25 09:41:42 +08:00
|
|
|
#include "portable.h"
|
|
|
|
|
1998-08-09 08:43:13 +08:00
|
|
|
#include <stdio.h>
|
1999-06-03 08:37:44 +08:00
|
|
|
|
|
|
|
#include <ac/stdlib.h>
|
1998-11-22 04:39:24 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_PSAP_H
|
1998-08-09 08:43:13 +08:00
|
|
|
#include <psap.h>
|
|
|
|
#include <quipu/attr.h>
|
1998-11-22 04:39:24 +08:00
|
|
|
#endif
|
1998-08-09 08:43:13 +08:00
|
|
|
|
1998-11-22 14:43:49 +08:00
|
|
|
int
|
1998-08-09 08:43:13 +08:00
|
|
|
main( int argc, char **argv )
|
|
|
|
{
|
1998-11-22 04:39:24 +08:00
|
|
|
#ifdef HAVE_PSAP_H
|
1998-08-09 08:43:13 +08:00
|
|
|
PE pe;
|
|
|
|
PS psin, psout, pserr;
|
|
|
|
|
|
|
|
/* read the pe from standard in */
|
|
|
|
if ( (psin = ps_alloc( std_open )) == NULLPS ) {
|
|
|
|
perror( "ps_alloc" );
|
1999-08-04 02:14:24 +08:00
|
|
|
exit( EXIT_FAILURE );
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
|
|
|
if ( std_setup( psin, stdin ) == NOTOK ) {
|
|
|
|
perror( "std_setup" );
|
1999-08-04 02:14:24 +08:00
|
|
|
exit( EXIT_FAILURE );
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
|
|
|
/* write the pe to standard out */
|
|
|
|
if ( (psout = ps_alloc( std_open )) == NULLPS ) {
|
|
|
|
perror( "ps_alloc" );
|
1999-08-04 02:14:24 +08:00
|
|
|
exit( EXIT_FAILURE );
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
|
|
|
if ( std_setup( psout, stdout ) == NOTOK ) {
|
|
|
|
perror( "std_setup" );
|
1999-08-04 02:14:24 +08:00
|
|
|
exit( EXIT_FAILURE );
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
|
|
|
/* pretty print it to standard error */
|
|
|
|
if ( (pserr = ps_alloc( std_open )) == NULLPS ) {
|
|
|
|
perror( "ps_alloc" );
|
1999-08-04 02:14:24 +08:00
|
|
|
exit( EXIT_FAILURE );
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
|
|
|
if ( std_setup( pserr, stderr ) == NOTOK ) {
|
|
|
|
perror( "std_setup" );
|
1999-08-04 02:14:24 +08:00
|
|
|
exit( EXIT_FAILURE );
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
while ( (pe = ps2pe( psin )) != NULLPE ) {
|
|
|
|
pe2pl( pserr, pe );
|
|
|
|
pe2ps( psout, pe );
|
|
|
|
}
|
|
|
|
|
1999-08-04 02:14:24 +08:00
|
|
|
exit( EXIT_SUCCESS );
|
1998-11-22 04:39:24 +08:00
|
|
|
#else
|
|
|
|
fprintf(stderr, "requires ISODE X.500 distribution.\n");
|
1999-05-19 09:12:33 +08:00
|
|
|
return( EXIT_FAILURE );
|
1998-11-22 04:39:24 +08:00
|
|
|
#endif
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|