- case 'd': /* turn on debugging */
- {
-#ifdef LDAP_DEBUG
- int level;
-
- if ( optarg != NULL && optarg[ 0 ] != '-' && !isdigit( optarg[ 0 ] ) )
- {
- if ( str2loglevel( optarg, &level ) ) {
- fprintf( stderr,
- "unrecognized log level "
- "\"%s\"\n", optarg );
- exit( EXIT_FAILURE );
- }
-
- } else if ( lutil_atoi( &level, optarg ) != 0 ) {
- fprintf( stderr,
- "unrecognized log level "
- "\"%s\"\n", optarg );
- exit( EXIT_FAILURE );
+ case 'd': { /* turn on debugging */
+ int level = 0;
+
+ if ( parse_debug_level( optarg, &level ) ) {
+ usage( tool, progname );