-
-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;
- FILE *f;
- f = fopen (script, "r");
- if (f == NULL) {
- Debug (LDAP_DEBUG_ANY, "Could not open scriptpath %s\n", script,
- 0, 0);
- exit (1);
- }
- fclose (f);
- code = Tcl_EvalFile (my_tcl, script);
- if (code != TCL_OK) {
- Debug (LDAP_DEBUG_ANY, "%s: %s\n", script,
- Tcl_GetVar (my_tcl, "errorInfo", TCL_GLOBAL_ONLY), 0);
- Debug (LDAP_DEBUG_ANY, "%s: error at line\n", script,
- my_tcl->errorLine, 0);
- exit (1);
- }
-}