]> git.sur5r.net Git - openldap/commitdiff
re-enable "-d '?'" as a means to list what loglevels are available (ITS#4666)
authorPierangelo Masarati <ando@openldap.org>
Fri, 8 Sep 2006 18:10:53 +0000 (18:10 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 8 Sep 2006 18:10:53 +0000 (18:10 +0000)
servers/slapd/bconfig.c
servers/slapd/main.c
servers/slapd/proto-slap.h

index efde6ef36c61eb805ece6e1ac74251a0944b8d39..0ed3bc41b677dda793ee0c6c0ca5d063de565061 100644 (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
index c7036fae5ca76719edb4d80c53f97300cab41883..8b1ee9c9c6300cd01aef7a657f6ef554e21be8e5 100644 (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;
                        }
index 4ca9f1dd2a9db8f898443c151eca8eb26d369971..7f91c961cff8ce4b598d5cbd3ff296c3c09e99f1 100644 (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 ));