22 fprintf( stderr, "usage: %s [-b] <attrtype>\n", name );
27 main( int argc, char **argv )
33 if (argc < 2 || argc > 3 ) {
37 if ( strcmp( argv[1], "-b" ) != 0 ) {
44 if ( strcmp( argv[1], "-b" ) == 0 ) {
50 /* if the -b flag was used, read single binary value from stdin */
55 if (( val = (char *) malloc( BUFSIZ )) == NULL ) {
61 while ( (nread = read( 0, buf, BUFSIZ )) != 0 ) {
62 if ( nread + cur > max ) {
64 if (( val = (char *) realloc( val, max )) ==
70 memcpy( val + cur, buf, nread );
74 if (( out = ldif_type_and_value( type, val, cur )) == NULL ) {
75 perror( "ldif_type_and_value" );
85 /* not binary: one value per line... */
86 while ( fgets( buf, sizeof(buf), stdin ) != NULL ) {
87 if( buf[len=strlen(buf)] == '\n') buf[len] = '\0';
89 if (( out = ldif_type_and_value( type, buf, strlen( buf ) ))
91 perror( "ldif_type_and_value" );
99 return( 0 ); /* NOT REACHED */