From a6730db3e9e7fb80d25165bab73ce3ec2a1326c5 Mon Sep 17 00:00:00 2001 From: Julius Enarusai Date: Thu, 11 Jul 2002 23:26:34 +0000 Subject: [PATCH] debug.c file moved from liblutil to liblber due to changes in LDAP_LOG macro and global variable ldap_logvels --- libraries/{liblutil => liblber}/debug.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) rename libraries/{liblutil => liblber}/debug.c (94%) diff --git a/libraries/liblutil/debug.c b/libraries/liblber/debug.c similarity index 94% rename from libraries/liblutil/debug.c rename to libraries/liblber/debug.c index 4cc883f104..4921bd2b30 100644 --- a/libraries/liblutil/debug.c +++ b/libraries/liblber/debug.c @@ -21,6 +21,7 @@ #include "ldap_log.h" #include "ldap_defaults.h" #include "lber.h" +#include "ldap_pvt.h" struct DEBUGLEVEL { @@ -74,7 +75,7 @@ int lutil_mnem2subsys( const char *subsys ) return i; } } - return 0; + return -1; } void lutil_set_all_backends( level ) @@ -100,26 +101,38 @@ int lutil_mnem2level( const char *level ) return i; } } - return 0; + return -1; } -static void addSubsys( const char *subsys, int level ) +static int addSubsys( const char *subsys, int level ) { int i, j, subsys_num; if ( !strcasecmp( subsys, "backend" ) ) + { lutil_set_all_backends( level ); + return level; + } else { subsys_num = lutil_mnem2subsys(subsys); + if(subsys_num < 0) + { + fprintf(stderr, "Unknown Subsystem name [ %s ] - Discarded\n", + subsys); + fflush(stderr); + return -1; + } + ldap_loglevels[subsys_num] = level; + return level; } - return; + return -1; } -void lutil_set_debug_level( const char* subsys, int level ) +int lutil_set_debug_level( const char* subsys, int level ) { - addSubsys( subsys, level ); + return( addSubsys( subsys, level ) ); } int lutil_debug_file( FILE *file ) -- 2.39.5