1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
--- src/limit.c Thu May 11 02:00:43 2000
+++ src/limit.c Fri Dec 1 20:04:58 2000
@@ -20,7 +20,6 @@
int
-LimitCmd(ClientData data, Tcl_Interp *interp, int argc, char *argv[])
+LimitCmd(ClientData data, Tcl_Interp *interp, int argc, Tcl_Obj *CONST objv[])
{
- int max;
- char buf[32];
struct rlimit limit;
+ Tcl_Obj *limObj[2];
Tcl_ResetResult(interp);
@@ -31,3 +30,4 @@
if (argc > 1) {
- Tcl_GetInt(interp, argv[1], (int *)&limit.rlim_cur);
+ if (Tcl_GetLongFromObj(interp, objv[1], (long *)&limit.rlim_cur)
+ != TCL_OK) return TCL_ERROR;
if (setrlimit(RLIMIT_NOFILE, &limit) < 0) {
@@ -37,3 +37,5 @@
}
- sprintf(interp->result, "%d %d", limit.rlim_cur, limit.rlim_max);
+ limObj[0] = Tcl_NewLongObj((long)limit.rlim_cur);
+ limObj[1] = Tcl_NewLongObj((long)limit.rlim_max);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, limObj));
return TCL_OK;
@@ -54,3 +56,3 @@
{
- Tcl_CreateCommand(interp, "limit", LimitCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "limit", LimitCmd, NULL, NULL);
Tcl_PkgProvide(interp, "limit", "1.0");
--- src/setuid.c Tue Oct 6 20:12:11 1998
+++ src/setuid.c Fri Dec 1 20:05:52 2000
@@ -7,2 +7,3 @@
#include <sys/types.h>
+#include <unistd.h>
--- src/utime.c Tue Oct 6 20:12:11 1998
+++ src/utime.c Fri Dec 1 20:14:21 2000
@@ -20,13 +20,8 @@
int
-UtimeCmd(ClientData data, Tcl_Interp *interp, int argc, char *argv[])
+UtimeCmd(ClientData data, Tcl_Interp *interp, int argc, Tcl_Obj *CONST objv[])
{
struct utimbuf u = {0, 0};
+ char *file;
Tcl_ResetResult(interp);
- if (argc > 3) {
- Tcl_GetInt(interp, argv[3], &u.actime); /* new access time */
- }
- if (argc > 2) {
- Tcl_GetInt(interp, argv[2], &u.modtime); /* new modify time */
- }
if (argc > 4 || argc <= 1) {
@@ -35,4 +30,13 @@
}
- if (utime(argv[1], &u) < 0) {
- Tcl_AppendResult(interp, "utime: ", argv[1], Tcl_PosixError(interp), NULL);
+ if (argc > 3) {
+ if (Tcl_GetLongFromObj(interp, objv[3], (long *)&u.actime)
+ != TCL_OK) return TCL_ERROR; /* new access time */
+ }
+ if (argc > 2) {
+ if (Tcl_GetLongFromObj(interp, objv[2], (long *)&u.modtime)
+ != TCL_OK) return TCL_ERROR; /* new modify time */
+ }
+ file = Tcl_GetString(objv[1]);
+ if (utime(file, &u) < 0) {
+ Tcl_AppendResult(interp, "utime: ", file, Tcl_PosixError(interp), NULL);
return TCL_ERROR;
@@ -55,3 +59,3 @@
{
- Tcl_CreateCommand(interp, "utime", UtimeCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "utime", UtimeCmd, NULL, NULL);
Tcl_PkgProvide(interp, "utime", "1.0");
|