Back to index

openldap  2.4.31
Functions
idtest.c File Reference
#include "portable.h"
#include <stdio.h>
#include <ac/stdlib.h>

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 43 of file idtest.c.

{
#ifdef HAVE_PSAP_H
       PE     pe;
       PS     psin, psout, pserr;

       /* read the pe from standard in */
       if ( (psin = ps_alloc( std_open )) == NULLPS ) {
              perror( "ps_alloc" );
              exit( EXIT_FAILURE );
       }
       if ( std_setup( psin, stdin ) == NOTOK ) {
              perror( "std_setup" );
              exit( EXIT_FAILURE );
       }
       /* write the pe to standard out */
       if ( (psout = ps_alloc( std_open )) == NULLPS ) {
              perror( "ps_alloc" );
              exit( EXIT_FAILURE );
       }
       if ( std_setup( psout, stdout ) == NOTOK ) {
              perror( "std_setup" );
              exit( EXIT_FAILURE );
       }
       /* pretty print it to standard error */
       if ( (pserr = ps_alloc( std_open )) == NULLPS ) {
              perror( "ps_alloc" );
              exit( EXIT_FAILURE );
       }
       if ( std_setup( pserr, stderr ) == NOTOK ) {
              perror( "std_setup" );
              exit( EXIT_FAILURE );
       }

       while ( (pe = ps2pe( psin )) != NULLPE ) {
              pe2pl( pserr, pe );
              pe2ps( psout, pe );
       }

       exit( EXIT_SUCCESS );
#else
       fprintf(stderr, "requires ISODE X.500 distribution.\n");
       return( EXIT_FAILURE );
#endif
}