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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
$NetBSD: patch-tnm_snmp_tnmMibTcl.c,v 1.1 2014/03/05 13:52:29 he Exp $
Constify.
Avoid use of interp->errorLine.
--- tnm/snmp/tnmMibTcl.c.orig 1999-03-08 08:39:23.000000000 +0000
+++ tnm/snmp/tnmMibTcl.c
@@ -18,16 +18,16 @@
static int
MibCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp,
- int argc, char **argv));
+ int argc, const char **argv));
static int
-LoadFileList _ANSI_ARGS_((Tcl_Interp *interp, char *fileList));
+LoadFileList _ANSI_ARGS_((Tcl_Interp *interp, const char *fileList));
static int
-LoadFile _ANSI_ARGS_((Tcl_Interp *interp, char *file));
+LoadFile _ANSI_ARGS_((Tcl_Interp *interp, const char *file));
static int
-WalkTree _ANSI_ARGS_((Tcl_Interp *interp, char *name,
- char *label, char *body, int exact,
+WalkTree _ANSI_ARGS_((Tcl_Interp *interp, const char *name,
+ const char *label, const char *body, int exact,
Tnm_MibNode* nodePtr, Tnm_Oid *oid, int len));
/*
@@ -77,11 +77,11 @@ MibCmd(clientData, interp, argc, argv)
ClientData clientData;
Tcl_Interp *interp;
int argc;
- char **argv;
+ const char **argv;
{
int exact = 0;
- char *cmd, *name, *arg;
- char *result = NULL;
+ const char *cmd, *name, *arg;
+ const char *result = NULL;
static int initialized = 0;
if (argc > 1 && strcmp(argv[1], "-exact") == 0) {
@@ -107,7 +107,7 @@ MibCmd(clientData, interp, argc, argv)
*/
if (! initialized) {
- char *mibFileList;
+ const char *mibFileList;
initialized = 1;
mibFileList = Tcl_GetVar2(interp, "tnm", "mibs:core", TCL_GLOBAL_ONLY);
@@ -166,7 +166,7 @@ MibCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (! result) goto notFound;
- Tcl_SetResult(interp, result, TCL_VOLATILE);
+ Tcl_SetResult(interp, (char*)result, TCL_VOLATILE);
return TCL_OK;
}
@@ -179,7 +179,7 @@ MibCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (! result) goto notFound;
- Tcl_SetResult(interp, result, TCL_VOLATILE);
+ Tcl_SetResult(interp, (char*)result, TCL_VOLATILE);
return TCL_OK;
}
@@ -240,7 +240,7 @@ MibCmd(clientData, interp, argc, argv)
if (! result) goto notFound;
- Tcl_SetResult(interp, result, TCL_VOLATILE);
+ Tcl_SetResult(interp, (char*)result, TCL_VOLATILE);
return TCL_OK;
notFound:
@@ -268,10 +268,10 @@ notFound:
static int
LoadFileList(interp, fileList)
Tcl_Interp *interp;
- char *fileList;
+ const char *fileList;
{
int i, code, argc;
- char **argv;
+ const char **argv;
if (fileList == NULL) {
return TCL_OK;
@@ -315,11 +315,11 @@ LoadFileList(interp, fileList)
static int
LoadFile(interp, file)
Tcl_Interp *interp;
- char *file;
+ const char *file;
{
Tcl_DString fileBuffer, frozenFileBuffer;
- char *library, *cache, *arch, *fileName, *frozenFileName = NULL;
- char **fileArgv = NULL;
+ const char *library, *cache, *arch, *fileName, *frozenFileName = NULL;
+ const char **fileArgv = NULL;
int fileArgc;
int code = TCL_OK;
@@ -465,9 +465,9 @@ LoadFile(interp, file)
static int
WalkTree(interp, varName, label, body, exact, nodePtr, oid, len)
Tcl_Interp *interp;
- char *varName;
- char *label;
- char *body;
+ const char *varName;
+ const char *label;
+ const char *body;
int exact;
Tnm_MibNode* nodePtr;
Tnm_Oid *oid;
@@ -487,8 +487,7 @@ WalkTree(interp, varName, label, body, e
}
while (nodePtr) {
-
- char *val, *label;
+ const char *val, *label;
if (doall && oid) {
oid[len-1] = nodePtr->subid;
@@ -522,7 +521,7 @@ WalkTree(interp, varName, label, body, e
} else if (result == TCL_ERROR) {
char msg[100];
sprintf(msg, "\n (\"mib walk\" body line %d)",
- interp->errorLine);
+ Tcl_GetErrorLine(interp));
Tcl_AddErrorInfo(interp, msg);
goto loopDone;
} else {
|