1 /* dtest.c - lber decoding test program */
3 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 * Copyright (c) 1990 Regents of the University of Michigan.
10 * Redistribution and use in source and binary forms are permitted
11 * provided that this notice is preserved and that due credit is given
12 * to the University of Michigan at Ann Arbor. The name of the University
13 * may not be used to endorse or promote products derived from this
14 * software without specific prior written permission. This software
15 * is provided ``as is'' without express or implied warranty.
23 #include <ac/string.h>
24 #include <ac/socket.h>
25 #include <ac/unistd.h>
33 static void usage( char *name )
35 fprintf( stderr, "usage: %s fmt\n", name );
39 main( int argc, char **argv )
52 memset( &sb, 0, sizeof(sb) );
54 sb.sb_ber.ber_buf = NULL;
56 if ( (tag = ber_get_next( &sb, &len, &ber )) == -1 ) {
57 perror( "ber_get_next" );
60 printf( "message has tag 0x%x and length %ld\n", tag, len );
62 if ( ber_scanf( &ber, "i", &i ) == -1 ) {
63 fprintf( stderr, "ber_scanf returns -1\n" );
66 printf( "got int %ld\n", i );