From: Kurt Zeilenga Date: Fri, 26 May 2000 19:52:40 +0000 (+0000) Subject: Add -n serviceName (for loggging purposes) X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2850 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e8c292df89cc6ca558f1f54b3f67a124991e633d;p=openldap Add -n serviceName (for loggging purposes) --- diff --git a/doc/man/man8/slapd.8 b/doc/man/man8/slapd.8 index 4c33418c59..1e353dd3b5 100644 --- a/doc/man/man8/slapd.8 +++ b/doc/man/man8/slapd.8 @@ -9,7 +9,7 @@ slapd \- Stand-alone LDAP Daemon .B [\-f slapd\-config\-file] .B [\-h URLs] .B [\-d debug\-level] -.B [\-s syslog\-level] [\-l syslog\-local\-user] +.B [\-n service\-name] [\-s syslog\-level] [\-l syslog\-local\-user] .B [\-u user] [\-g group] .B .SH DESCRIPTION @@ -73,6 +73,10 @@ at what level debugging statements should be logged to the .BR syslog (8) facility. .TP +.BI \-n " service\-name" +Specifies the service name for logging and other purposes. Defaults +to basename of argv[0], i.e.: "slapd". +.TP .BI \-l " syslog\-local\-user" Selects the local user of the .BR syslog (8) diff --git a/servers/slapd/main.c b/servers/slapd/main.c index bc50274a1e..5e877b57f3 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -112,10 +112,7 @@ usage( char *name ) #ifdef LOG_LOCAL4 "\t-l sysloguser\tSyslog User (default: LOCAL4)\n" #endif -#ifdef HAVE_NT_EVENT_LOG - "\t-n NTserviceName\tNT service name\n" -#endif - + "\t-n serviceName\tservice name\n" "\t-s level\tSyslog Level\n" #ifdef SLAPD_BDB2 "\t-t\t\tEnable BDB2 timing\n" @@ -146,15 +143,12 @@ int main( int argc, char **argv ) int syslogUser = DEFAULT_SYSLOG_USER; #endif -#ifdef HAVE_NT_EVENT_LOG - char *NTservice = SERVICE_NAME; -#endif #ifdef HAVE_NT_SERVICE_MANAGER char *configfile = ".\\slapd.conf"; #else char *configfile = SLAPD_DEFAULT_CONFIGFILE; #endif - char *serverName; + char *serverName = NULL; int serverMode = SLAP_SERVER_MODE; #ifdef CSRIMALLOC @@ -209,7 +203,7 @@ int main( int argc, char **argv ) #endif while ( (i = getopt( argc, argv, - "d:f:h:s:" + "d:f:h:s:n:" #ifdef HAVE_CHROOT "r:" #endif @@ -224,9 +218,6 @@ int main( int argc, char **argv ) #endif #ifdef LDAP_CONNECTIONLESS "c" -#endif -#ifdef HAVE_NT_EVENT_LOG - "n:" #endif )) != EOF ) { switch ( i ) { @@ -294,11 +285,11 @@ int main( int argc, char **argv ) break; #endif /* SETUID && GETUID */ -#ifdef HAVE_NT_EVENT_LOG case 'n': /* NT service name */ - NTservice = ch_strdup( optarg ); + if( serverName != NULL ) free( serverName ); + serverName = ch_strdup( optarg ); break; -#endif + default: usage( argv[0] ); rc = 1; @@ -313,10 +304,12 @@ int main( int argc, char **argv ) Debug( LDAP_DEBUG_TRACE, "%s", Versionstr, 0, 0 ); - if ( (serverName = strrchr( argv[0], *LDAP_DIRSEP )) == NULL ) { - serverName = ch_strdup( argv[0] ); - } else { - serverName = ch_strdup( serverName + 1 ); + if( serverName == NULL ) { + if ( (serverName = strrchr( argv[0], *LDAP_DIRSEP )) == NULL ) { + serverName = ch_strdup( argv[0] ); + } else { + serverName = ch_strdup( serverName + 1 ); + } } #ifdef LOG_LOCAL4