From: Kurt Zeilenga Date: Thu, 19 Aug 1999 17:20:15 +0000 (+0000) Subject: Centralize slap init/startup/shutdown/destroy into slapcommon X-Git-Tag: TWEB_OL_BASE~157 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a1987f662d031d04990edbe3b624488aaf8a3376;p=openldap Centralize slap init/startup/shutdown/destroy into slapcommon --- diff --git a/servers/slapd/tools/slapadd.c b/servers/slapd/tools/slapadd.c index d815e444cb..abc894b71c 100644 --- a/servers/slapd/tools/slapadd.c +++ b/servers/slapd/tools/slapadd.c @@ -24,7 +24,6 @@ main( int argc, char **argv ) int rc = EXIT_SUCCESS; slap_tool_init( "slapadd", SLAPADD, argc, argv ); - slap_startup( be ); if( !be->be_entry_open && !be->be_entry_close && @@ -112,8 +111,6 @@ main( int argc, char **argv ) be->be_sync( be ); } - slap_shutdown( be ); - slap_destroy(); - + slap_tool_destroy(); return rc; } diff --git a/servers/slapd/tools/slapcat.c b/servers/slapd/tools/slapcat.c index 32fa0214ad..80e698cba3 100644 --- a/servers/slapd/tools/slapcat.c +++ b/servers/slapd/tools/slapcat.c @@ -21,8 +21,6 @@ main( int argc, char **argv ) slap_tool_init( "slapcat", SLAPCAT, argc, argv ); - slap_startup( be ); - if( !be->be_entry_open && !be->be_entry_close && !be->be_entry_first && @@ -75,8 +73,6 @@ main( int argc, char **argv ) be->be_entry_close( be ); - slap_shutdown( be ); - slap_destroy(); - + slap_tool_destroy(); return rc; } diff --git a/servers/slapd/tools/slapcommon.c b/servers/slapd/tools/slapcommon.c index b9a98f55e8..3f5e0eef9f 100644 --- a/servers/slapd/tools/slapcommon.c +++ b/servers/slapd/tools/slapcommon.c @@ -211,4 +211,12 @@ slap_tool_init( } else { be = &backends[dbnum]; } + + slap_startup( be ); +} + +void slap_tool_destroy( void ) +{ + slap_shutdown( be ); + slap_destroy(); } diff --git a/servers/slapd/tools/slapcommon.h b/servers/slapd/tools/slapcommon.h index c610539c91..ffa4007861 100644 --- a/servers/slapd/tools/slapcommon.h +++ b/servers/slapd/tools/slapcommon.h @@ -35,4 +35,6 @@ void slap_tool_init LDAP_P(( int tool, int argc, char **argv )); +void slap_tool_destroy LDAP_P((void)); + #endif /* SLAPCOMMON_H_ */ diff --git a/servers/slapd/tools/slapindex.c b/servers/slapd/tools/slapindex.c index 31ae1e3b1e..77abcd9798 100644 --- a/servers/slapd/tools/slapindex.c +++ b/servers/slapd/tools/slapindex.c @@ -24,8 +24,6 @@ main( int argc, char **argv ) slap_tool_init( "slapindex", SLAPINDEX, argc, argv ); - slap_startup( be ); - if( !be->be_entry_open && !be->be_entry_close && !be->be_entry_first && @@ -111,8 +109,7 @@ main( int argc, char **argv ) (void) be->be_entry_close( be ); - slap_shutdown( be ); - slap_destroy(); + slap_tool_destroy(); return( rc ); }