1 diff -ur expect-5.43.orig/exp_command.c expect-5.43/exp_command.c
2 --- expect-5.43.orig/exp_command.c 2004-08-20 19:18:01.000000000 +0200
3 +++ expect-5.43/exp_command.c 2008-01-19 17:40:20.000000000 +0100
8 +static struct exp_cmd_data cmd_data[];
12 Exp_CloseObjCmd(clientData, interp, objc, objv)
13 @@ -2311,12 +2313,23 @@
14 /* Historical note: we used "close" long before there was a */
15 /* Tcl builtin by the same name. */
17 + /* The code that registered this function as the handler for */
18 + /* the "close" command stored away the old handler in the */
19 + /* exp_cmd_data for the "close" command. */
21 + struct exp_cmd_data *cmd_ptr;
24 + for(cmd_ptr = &cmd_data[0]; cmd_ptr->name; cmd_ptr++) {
25 + if(strncmp(cmd_ptr->name, "close", 5) == 0)
29 Tcl_ResetResult(interp);
30 if (0 == Tcl_GetCommandInfo(interp,"close",&info)) {
33 - return(Tcl_CloseObjCmd(info.clientData,interp,objc_orig,objv_orig));
34 + return(cmd_ptr->old_objProc(info.clientData,interp,objc_orig,objv_orig));
38 @@ -2961,7 +2974,10 @@
39 /* if successful (i.e., TCL_RETURN is returned) */
40 /* modify the result, so that we will handle it specially */
42 - int result = Tcl_ReturnObjCmd(clientData,interp,objc,objv);
44 + Tcl_GetCommandInfo(interp, "return", &info);
46 + int result = info.objProc(clientData,interp,objc,objv);
47 if (result == TCL_RETURN)
48 result = EXP_TCL_RETURN;
53 /* if already defined, don't redefine */
54 - if ((c->flags & EXP_REDEFINE) ||
55 - !(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) ||
56 + if (!(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) ||
57 Tcl_FindHashEntry(&currNsPtr->cmdTable,c->name))) {
59 Tcl_CreateObjCommand(interp,c->name,
60 @@ -3072,6 +3087,21 @@
61 Tcl_CreateCommand(interp,c->name,c->proc,
62 c->data,exp_deleteProc);
64 + else if (c->flags & EXP_REDEFINE) { /* unless the REDEFINE flag is present */
67 + if (Tcl_GetCommandInfo(interp, c->name, &info)) {
68 + c->old_proc = info.proc;
69 + c->old_objProc = info.objProc;
73 + Tcl_CreateObjCommand(interp,c->name,
74 + c->objproc,c->data,exp_deleteObjProc);
76 + Tcl_CreateCommand(interp,c->name,c->proc,
77 + c->data,exp_deleteProc);
79 if (!(c->name[0] == 'e' &&
82 diff -ur expect-5.43.orig/exp_command.h expect-5.43/exp_command.h
83 --- expect-5.43.orig/exp_command.h 2004-07-30 17:35:28.000000000 +0200
84 +++ expect-5.43/exp_command.h 2008-01-19 17:40:20.000000000 +0100
89 + Tcl_CmdProc *old_proc; /* these store the procedure for the old command, */
90 + Tcl_ObjCmdProc *old_objProc; /* if any */
93 EXTERN void exp_create_commands _ANSI_ARGS_((Tcl_Interp *,
94 diff -ur expect-5.43.orig/exp_inter.c expect-5.43/exp_inter.c
95 --- expect-5.43.orig/exp_inter.c 2004-08-18 04:03:00.000000000 +0200
96 +++ expect-5.43/exp_inter.c 2008-01-19 17:40:01.000000000 +0100
105 #include "exp_tty_in.h"