Line 0
Link Here
|
|
|
1 |
--- whiptcl.c.orig |
2 |
+++ whiptcl.c |
3 |
@@ -137,45 +137,45 @@ |
4 |
|
5 |
if (arg < -1) { |
6 |
/* this could buffer oveflow, bug we're not setuid so I don't care */ |
7 |
- interp->result = malloc(200); |
8 |
- interp->freeProc = TCL_DYNAMIC; |
9 |
- sprintf(interp->result, "%s: %s\n", |
10 |
+ char *tmp = malloc(200); |
11 |
+ sprintf(tmp, "%s: %s\n", |
12 |
poptBadOption(optCon, POPT_BADOPTION_NOALIAS), |
13 |
poptStrerror(arg)); |
14 |
+ Tcl_SetResult(interp, tmp, TCL_DYNAMIC); |
15 |
|
16 |
return TCL_ERROR; |
17 |
} |
18 |
|
19 |
if (mode == MODE_NONE) { |
20 |
- interp->result = "no dialog mode was specified"; |
21 |
+ Tcl_SetResult(interp, "no dialog mode was specified", TCL_STATIC); |
22 |
return TCL_ERROR; |
23 |
} else if (rc) { |
24 |
- interp->result = "multiple modes were specified"; |
25 |
+ Tcl_SetResult(interp, "multiple modes were specified", TCL_STATIC); |
26 |
return TCL_ERROR; |
27 |
} |
28 |
|
29 |
if (!(text = poptGetArg(optCon))) { |
30 |
- interp->result = "missing text parameter"; |
31 |
+ Tcl_SetResult(interp, "missing text parameter", TCL_STATIC); |
32 |
return TCL_ERROR; |
33 |
} |
34 |
|
35 |
if (!(nextArg = poptGetArg(optCon))) { |
36 |
- interp->result = "height missing"; |
37 |
+ Tcl_SetResult(interp, "height missing", TCL_STATIC); |
38 |
return TCL_ERROR; |
39 |
} |
40 |
height = strtoul(nextArg, &end, 10); |
41 |
if (*end) { |
42 |
- interp->result = "height is not a number"; |
43 |
+ Tcl_SetResult(interp, "height is not a number", TCL_STATIC); |
44 |
return TCL_ERROR; |
45 |
} |
46 |
|
47 |
if (!(nextArg = poptGetArg(optCon))) { |
48 |
- interp->result = "width missing"; |
49 |
+ Tcl_SetResult(interp, "width missing", TCL_STATIC); |
50 |
return TCL_ERROR; |
51 |
} |
52 |
width = strtoul(nextArg, &end, 10); |
53 |
if (*end) { |
54 |
- interp->result = "width is not a number"; |
55 |
+ Tcl_SetResult(interp, "width is not a number", TCL_STATIC); |
56 |
return TCL_ERROR; |
57 |
} |
58 |
|
59 |
@@ -196,33 +196,30 @@ |
60 |
case MODE_YESNO: |
61 |
rc = messageBox(text, height, width, MSGBOX_YESNO, flags); |
62 |
if (rc == DLG_OKAY) |
63 |
- interp->result = "yes"; |
64 |
+ Tcl_SetResult(interp, "yes", TCL_STATIC); |
65 |
else |
66 |
- interp->result = "no"; |
67 |
+ Tcl_SetResult(interp, "no", TCL_STATIC); |
68 |
if (rc == DLG_ERROR) rc = 0; |
69 |
break; |
70 |
|
71 |
case MODE_INPUTBOX: |
72 |
rc = inputBox(text, height, width, optCon, flags, &result); |
73 |
if (rc ==DLG_OKAY) { |
74 |
- interp->result = result; |
75 |
- interp->freeProc = TCL_DYNAMIC; |
76 |
+ Tcl_SetResult(interp, strdup(result), TCL_DYNAMIC); |
77 |
} |
78 |
break; |
79 |
|
80 |
case MODE_MENU: |
81 |
rc = listBox(text, height, width, optCon, flags, default_item, &result); |
82 |
if (rc==DLG_OKAY) { |
83 |
- interp->result = result; |
84 |
- interp->freeProc = TCL_DYNAMIC; |
85 |
+ Tcl_SetResult(interp, strdup(result), TCL_DYNAMIC); |
86 |
} |
87 |
break; |
88 |
|
89 |
case MODE_RADIOLIST: |
90 |
rc = checkList(text, height, width, optCon, 1, flags, &selections); |
91 |
if (rc==DLG_OKAY) { |
92 |
- interp->result = selections[0]; |
93 |
- interp->freeProc = TCL_DYNAMIC; |
94 |
+ Tcl_SetResult(interp, strdup(selections[0]), TCL_DYNAMIC); |
95 |
|
96 |
free(selections); |
97 |
} |
98 |
@@ -247,7 +244,7 @@ |
99 |
newtPopWindow(); |
100 |
|
101 |
if (rc == DLG_ERROR) { |
102 |
- interp->result = "bad paramter for whiptcl dialog box"; |
103 |
+ Tcl_SetResult(interp, "bad paramter for whiptcl dialog box", TCL_STATIC); |
104 |
return TCL_ERROR; |
105 |
} |
106 |
|