]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/args.c
Fix modlist bug in last commit
[openldap] / servers / slurpd / args.c
index 678954bf142aee3158bc307bcb333f6356a6966a..8927be57ef47101e4be3e4a55c92f08169a17f7c 100644 (file)
 
 #include <stdio.h>
 
+#include <ac/stdlib.h>
 #include <ac/string.h>
 #include <ac/time.h>
+#include <ac/unistd.h>
 
 #include <lber.h>
 #include <ldap.h>
@@ -28,7 +30,7 @@
 #include "globals.h"
 
 
-static int
+static void
 usage( char *name )
 {
     fprintf( stderr, "usage: %s\t[-d debug-level] [-s syslog-level]\n", name );
@@ -53,7 +55,6 @@ doargs(
 )
 {
     int                i;
-    extern char        *optarg;
     int                rflag = 0;
 
     if ( (g->myname = strrchr( argv[0], '/' )) == NULL ) {
@@ -64,8 +65,8 @@ doargs(
 
     while ( (i = getopt( argc, argv, "hd:f:r:t:k:o" )) != EOF ) {
        switch ( i ) {
-#ifdef LDAP_DEBUG
        case 'd':       /* turn on debugging */
+#ifdef LDAP_DEBUG
            if ( optarg[0] == '?' ) {
                printf( "Debug levels:\n" );
                printf( "\tLDAP_DEBUG_TRACE\t%d\n",
@@ -88,14 +89,13 @@ doargs(
                        LDAP_DEBUG_ANY );
                return( -1 );
            } else {
-               ldap_debug = atoi( optarg );
+               ldap_debug |= atoi( optarg );
            }
-           break;
 #else /* LDAP_DEBUG */
-       case 'd':       /* can't enable debugging - not built with debug code */
+               /* can't enable debugging - not built with debug code */
            fprintf( stderr, "must compile with LDAP_DEBUG for debugging\n" );
-           break;
 #endif /* LDAP_DEBUG */
+           break;
        case 'f':       /* slapd config file */
            g->slapd_configfile = strdup( optarg );
            break;
@@ -139,6 +139,10 @@ doargs(
     sprintf( g->slurpd_status_file, "%s/%s", g->slurpd_rdir,
            DEFAULT_SLURPD_STATUS_FILE );
 
+       ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldap_debug);
+       ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &ldap_debug);
+       ldif_debug = ldap_debug;
+
 #ifdef LOG_LOCAL4
     openlog( g->myname, OPENLOG_OPTIONS, LOG_LOCAL4 );
 #else