- if ( ber_scanf( ber, "i", &i ) == LBER_ERROR ) {
- fprintf( stderr, "ber_scanf returns -1\n" );
- exit( EXIT_FAILURE );
+ printf("decode: message tag 0x%lx and length %ld\n",
+ (unsigned long) tag, (long) len );
+
+ for( s = argv[1]; *s; s++ ) {
+ char buf[128];
+ char fmt[2];
+ fmt[0] = *s;
+ fmt[1] = '\0';
+
+ printf("decode: format %s\n", fmt );
+ len = sizeof(buf);
+ tag = ber_scanf( ber, fmt, &buf[0], &len );
+
+ if( tag == LBER_ERROR ) {
+ perror( "ber_scanf" );
+ return( EXIT_FAILURE );
+ }