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$ */
|
1998-12-29 04:38:04 +08:00
|
|
|
/*
|
2003-01-04 04:20:47 +08:00
|
|
|
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
1998-12-29 04:38:04 +08:00
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
*/
|
1998-12-29 04:46:13 +08:00
|
|
|
/* Portions
|
1998-08-09 08:43:13 +08:00
|
|
|
* Copyright (c) 1990 Regents of the University of Michigan.
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
}
|