re-enable "-d '?'" as a means to list what loglevels are available (ITS#4666)

This commit is contained in:
Pierangelo Masarati 2006-09-08 18:10:53 +00:00
parent b60990780f
commit c3f9d68027
3 changed files with 33 additions and 0 deletions

View File

@ -2358,6 +2358,28 @@ loglevel2bvarray( int l, BerVarray *bva )
return mask_to_verbs( loglevel_ops, l, bva );
}
int
loglevel_print( FILE *out )
{
int i;
if ( loglevel_ops == NULL ) {
loglevel_init();
}
fprintf( out, "Installed log subsystems:\n\n" );
for ( i = 0; !BER_BVISNULL( &loglevel_ops[ i ].word ); i++ ) {
fprintf( out, "\t%-30s (%d)\n",
loglevel_ops[ i ].word.bv_val,
loglevel_ops[ i ].mask );
}
fprintf( out, "\nNOTE: custom log subsystems may be later installed "
"by specific code\n\n" );
return 0;
}
static int config_syslog;
static int

View File

@ -501,6 +501,11 @@ int main( int argc, char **argv )
case 'd': { /* set debug level and 'do not detach' flag */
int level = 0;
if ( strcmp( optarg, "?" ) == 0 ) {
rc = loglevel_print( stdout );
goto destroy;
}
no_detach = 1;
if ( parse_debug_level( optarg, &level, &debug_unknowns ) ) {
goto destroy;
@ -557,6 +562,11 @@ int main( int argc, char **argv )
}
case 's': /* set syslog level */
if ( strcmp( optarg, "?" ) == 0 ) {
rc = loglevel_print( stdout );
goto destroy;
}
if ( parse_debug_level( optarg, &ldap_syslog, &syslog_unknowns ) ) {
goto destroy;
}

View File

@ -429,6 +429,7 @@ LDAP_SLAPD_F (int) str2loglevel LDAP_P(( const char *s, int *l ));
LDAP_SLAPD_F (int) loglevel2bvarray LDAP_P(( int l, BerVarray *bva ));
LDAP_SLAPD_F (const char *) loglevel2str LDAP_P(( int l ));
LDAP_SLAPD_F (int) loglevel2bv LDAP_P(( int l, struct berval *bv ));
LDAP_SLAPD_F (int) loglevel_print LDAP_P(( FILE *out ));
LDAP_SLAPD_F (int) slap_cf_aux_table_parse LDAP_P(( const char *word, void *bc, slap_cf_aux_table *tab0, LDAP_CONST char *tabmsg ));
LDAP_SLAPD_F (int) slap_cf_aux_table_unparse LDAP_P(( void *bc, struct berval *bv, slap_cf_aux_table *tab0 ));