From 78a5ebe216c6dbf0a57f18aa98b6247999f5dcb8 Mon Sep 17 00:00:00 2001 From: Ben Collins Date: Wed, 17 Feb 1999 01:53:59 +0000 Subject: [PATCH] Moved tcl_back_db_open() and interpreter init to tcl_init.c --- servers/slapd/back-tcl/tcl_config.c | 37 +++++++++-------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/servers/slapd/back-tcl/tcl_config.c b/servers/slapd/back-tcl/tcl_config.c index 9030be75af..2b083c9ef7 100644 --- a/servers/slapd/back-tcl/tcl_config.c +++ b/servers/slapd/back-tcl/tcl_config.c @@ -8,9 +8,12 @@ * license is available at http://www.OpenLDAP.org/license.html or * in file LICENSE in the top-level directory of the distribution. * - * $Id$ + * $Id: tcl_config.c,v 1.2 1999/02/16 23:30:36 bcollins Exp $ + * + * $Log: tcl_config.c,v $ + * Revision 1.2 1999/02/16 23:30:36 bcollins + * fixed exit()'s to be return()'s * - * $Log$ */ #include "portable.h" @@ -65,6 +68,7 @@ int tcl_back_db_config ( ti->ti_ii = NULL; ii = global_i; + /* Try to see if it already exists */ do { if (ii != NULL && !strcasecmp (ii->name, argv[1])) ti->ti_ii = ii; @@ -72,15 +76,15 @@ int tcl_back_db_config ( ii = ii->next; } while (ii->next != NULL); - if (ti->ti_ii == NULL) { /* we need to make a new one */ - ii->next = (struct i_info *) ch_malloc (sizeof (struct i_info)); + if (ti->ti_ii == NULL) { /* we need to make a new one */ + ii->next = (struct i_info *) ch_malloc + (sizeof (struct i_info)); ii->next->count = 0; ii->next->name = (char *) strdup (argv[1]); + ii->next->interp = NULL; ii->next->next = NULL; - ii->next->interp = Tcl_CreateInterp (); - Tcl_Init (ii->next->interp); - ti->ti_ii = ii; + ti->ti_ii = ii->next; } /* proc for binds */ @@ -182,25 +186,6 @@ int tcl_back_db_config ( return 0; } -int tcl_back_db_open ( - BackendDB * bd -) -{ - struct tclinfo *ti = (struct tclinfo *) bd->be_private; - - /* raise that count for the interpreter */ - ti->ti_ii->count++; - - /* now let's (try to) load the script */ - readtclscript (ti->script_path, ti->ti_ii->interp); - - /* Intall the debug command */ - Tcl_CreateCommand( ti->ti_ii->interp, "ldap:debug", &tcl_ldap_debug, - NULL, NULL); - - return 0; -} - void readtclscript (char *script, Tcl_Interp * my_tcl) { int code; -- 2.39.5