2 * abandon.c - tcl abandon routine
4 * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
6 * Redistribution and use in source and binary forms are permitted only
7 * as authorized by the OpenLDAP Public License. A copy of this
8 * license is available at http://www.OpenLDAP.org/license.html or
9 * in file LICENSE in the top-level directory of the distribution.
19 int tcl_back_abandon (
26 char *suf_tcl, *results, *command;
28 struct tclinfo *ti = (struct tclinfo *) be->be_private;
30 if (ti->ti_abandon == NULL) {
34 for ( i = 0; be->be_suffix[i] != NULL; i++ )
36 suf_tcl = Tcl_Merge(i, be->be_suffix);
38 command = (char *) ch_malloc (strlen(ti->ti_abandon) + strlen(suf_tcl)
40 sprintf(command, "%s ABANDON {%ld} {%s}",
41 ti->ti_abandon, op->o_msgid, suf_tcl);
44 ldap_pvt_thread_mutex_lock( &tcl_interpreter_mutex );
45 code = Tcl_GlobalEval(ti->ti_ii->interp, command);
46 results = (char *) strdup(ti->ti_ii->interp->result);
47 ldap_pvt_thread_mutex_unlock( &tcl_interpreter_mutex );
51 Debug(LDAP_DEBUG_ANY, "tcl_abandon_error: %s\n", results, 0, 0);