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.
27 char *suf_tcl, *results, *command;
29 struct tclinfo *ti = (struct tclinfo *) be->be_private;
31 if (ti->ti_abandon == NULL) {
35 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 *) ch_strdup (ti->ti_ii->interp->result);
47 ldap_pvt_thread_mutex_unlock (&tcl_interpreter_mutex);
51 err = LDAP_OPERATIONS_ERROR;
52 Debug (LDAP_DEBUG_SHELL, "tcl_abandon_error: %s\n", results,