summaryrefslogtreecommitdiff
path: root/net/tcl-scotty/patches/patch-tnm_generic_tnmSunRpc.c
blob: 047063fb02b1d23fb8697c68b073bba68e005375 (plain)
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
$NetBSD: patch-tnm_generic_tnmSunRpc.c,v 1.1 2014/03/05 13:52:29 he Exp $

Avoid use of interp->result.
Constify.

--- tnm/generic/tnmSunRpc.c~	1996-10-23 12:26:17.000000000 +0200
+++ tnm/generic/tnmSunRpc.c	2014-03-04 15:59:47.000000000 +0100
@@ -84,52 +84,52 @@
 SunrpcError		_ANSI_ARGS_((Tcl_Interp *interp, int res));
 
 static char*
-SunrpcGetHostname	_ANSI_ARGS_((Tcl_Interp *interp,  char *str));
+SunrpcGetHostname	_ANSI_ARGS_((Tcl_Interp *interp, const char *str));
 
 static int 
-SunrpcOpenEtherd	_ANSI_ARGS_((Tcl_Interp *interp, char *host));
+SunrpcOpenEtherd	_ANSI_ARGS_((Tcl_Interp *interp, const char *host));
 
 static int
-SunrpcCloseEtherd	_ANSI_ARGS_((Tcl_Interp *interp, char *host));
+SunrpcCloseEtherd	_ANSI_ARGS_((Tcl_Interp *interp, const char *host));
 
 static int
-SunrpcEtherd		_ANSI_ARGS_((Tcl_Interp *interp, char *host));
+SunrpcEtherd		_ANSI_ARGS_((Tcl_Interp *interp, const char *host));
 
 static int
-SunrpcRstat		_ANSI_ARGS_((Tcl_Interp *interp, char *host));
+SunrpcRstat		_ANSI_ARGS_((Tcl_Interp *interp, const char *host));
 
 static int
-SunrpcInfo		_ANSI_ARGS_((Tcl_Interp *interp, char *host));
+SunrpcInfo		_ANSI_ARGS_((Tcl_Interp *interp, const char *host));
 
 static int
-SunrpcMount		_ANSI_ARGS_((Tcl_Interp *interp, char *host));
+SunrpcMount		_ANSI_ARGS_((Tcl_Interp *interp, const char *host));
 
 static int
-SunrpcExports		_ANSI_ARGS_((Tcl_Interp *interp, char *host));
+SunrpcExports		_ANSI_ARGS_((Tcl_Interp *interp, const char *host));
 
 static int
-SunrpcProbe		_ANSI_ARGS_((Tcl_Interp *interp, char *host, 
+SunrpcProbe		_ANSI_ARGS_((Tcl_Interp *interp, const char *host, 
 				     unsigned long prognum,
 				     unsigned long version, 
 				     unsigned protocol));
 #if 0
 static int
-SunrpcQuota		_ANSI_ARGS_((Tcl_Interp *interp, char *host,
-				     char *user));
+SunrpcQuota		_ANSI_ARGS_((Tcl_Interp *interp, const char *host,
+				     const char *user));
 #endif
 
 static int
-PcnfsInfo		_ANSI_ARGS_((Tcl_Interp *interp, char *host,
+PcnfsInfo		_ANSI_ARGS_((Tcl_Interp *interp, const char *host,
 				     char *array));
 static int 
-PcnfsQueue		_ANSI_ARGS_((Tcl_Interp *interp, char *host, 
-				     char *printer, char *array));
+PcnfsQueue		_ANSI_ARGS_((Tcl_Interp *interp, const char *host, 
+				     const char *printer, char *array));
 static int 
-PcnfsList		_ANSI_ARGS_((Tcl_Interp *interp, char *host,
+PcnfsList		_ANSI_ARGS_((Tcl_Interp *interp, const char *host,
 				     char *array));
 static int 
-PcnfsStatus		_ANSI_ARGS_((Tcl_Interp *interp, char *host, 
-				     char *printer, char *array));
+PcnfsStatus		_ANSI_ARGS_((Tcl_Interp *interp, const char *host, 
+				     const char *printer, char *array));
 
 
 /*
@@ -208,7 +208,7 @@
 static char* 
 SunrpcGetHostname(interp, str)
     Tcl_Interp *interp;
-    char *str;
+    const char *str;
 {
     struct sockaddr_in addr;
 
@@ -238,7 +238,7 @@
 static int 
 SunrpcOpenEtherd(interp, host)
     Tcl_Interp *interp;
-    char *host;
+    const char *host;
 {
     int dummy;
     CLIENT *clnt;
@@ -312,7 +312,7 @@
 static int 
 SunrpcCloseEtherd(interp, host)
     Tcl_Interp *interp;
-    char *host;
+    const char *host;
 {
     int dummy;
     EtherClient *p;
@@ -365,7 +365,7 @@
 static int
 SunrpcEtherd(interp, host)
     Tcl_Interp *interp;
-    char *host;
+    const char *host;
 {
     int dummy, tdiff, i;
     EtherClient *p;
@@ -473,7 +473,7 @@
 static int
 SunrpcRstat(interp, host)
     Tcl_Interp *interp;
-    char *host;
+    const char *host;
 {
     struct statstime statp;
     struct timeval timeout;
@@ -583,7 +583,7 @@
 static int
 SunrpcInfo(interp, host)
     Tcl_Interp *interp;
-    char *host;
+    const char *host;
 {
     struct sockaddr_in _addr;
     struct sockaddr_in *addr = &_addr;
@@ -630,7 +630,7 @@
 static int
 SunrpcMount(interp, host)
     Tcl_Interp *interp;
-    char *host;
+    const char *host;
 {
     mountlist ml = NULL;
     struct timeval timeout;
@@ -691,7 +691,7 @@
 static int
 SunrpcExports(interp, host)
     Tcl_Interp *interp;
-    char *host;
+    const char *host;
 {
     exports ex = NULL;
     groups gr;
@@ -775,7 +775,7 @@
 static int
 SunrpcProbe(interp, host, prognum, version, protocol)
     Tcl_Interp *interp;
-    char *host;
+    const char *host;
     unsigned long prognum;
     unsigned long version;
     unsigned protocol;
@@ -800,7 +800,7 @@
     }
 
     if ((protocol != IPPROTO_UDP) && (protocol != IPPROTO_TCP)) {
-	interp->result = "unknown protocol";
+        Tcl_SetResult(interp, "unknown protocol", TCL_STATIC);
 	return TCL_ERROR;
     }
 
@@ -847,8 +847,8 @@
 static int
 SunrpcQuota(interp, host, user)
     Tcl_Interp *interp;
-    char *host;
-    char *user;
+    const char *host;
+    const char *user;
 {
     struct sockaddr_in _addr;
     struct sockaddr_in *addr = &_addr;
@@ -914,7 +914,7 @@
 static int
 PcnfsInfo(interp, host, array)
     Tcl_Interp *interp;
-    char *host;
+    const char *host;
     char *array;
 {
     struct sockaddr_in _addr;
@@ -1012,8 +1012,8 @@
 static int 
 PcnfsQueue(interp, host, printer, array)
     Tcl_Interp *interp;
-    char *host;
-    char *printer;
+    const char *host;
+    const char *printer;
     char *array;
 {
     struct sockaddr_in _addr;
@@ -1024,9 +1024,10 @@
     v2_pr_queue_results *pr_qr;
     v2_pr_queue_args pr_args;
     pr_queue_item *pr_item;
+    char res[20];
     
-    pr_args.pn = printer;
-    pr_args.system = host;
+    pr_args.pn = (char*)printer;
+    pr_args.system = (char*) host;
     pr_args.user = "doug";
     pr_args.just_mine = FALSE;
     pr_args.cm = "";
@@ -1109,7 +1110,9 @@
 		}
 	    }
 	}
-	sprintf(interp->result, "%d", pr_qr->qlen);
+	
+	sprintf(res, "%d", pr_qr->qlen);
+	Tcl_SetResult(interp, res, TCL_VOLATILE);
     }
     
     return TCL_OK;
@@ -1134,7 +1137,7 @@
 static int 
 PcnfsList(interp, host, array)
     Tcl_Interp *interp;
-    char *host;
+    const char *host;
     char *array;
 {
     struct sockaddr_in _addr;
@@ -1219,8 +1222,8 @@
 static int 
 PcnfsStatus(interp, host, printer, array)
     Tcl_Interp *interp;
-    char *host;
-    char *printer;
+    const char *host;
+    const char *printer;
     char *array;
 {
     struct sockaddr_in _addr;
@@ -1231,7 +1234,7 @@
     v2_pr_status_args pr_stat;
     v2_pr_status_results *pr_sr;
     
-    pr_stat.pn = printer;
+    pr_stat.pn = (char*)printer;
     pr_stat.cm = "";
 
     timeout.tv_sec = 5; timeout.tv_usec = 0;
@@ -1317,7 +1320,7 @@
     ClientData clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char **argv;
 {
     if (argc < 3) {
 	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 
@@ -1366,7 +1369,7 @@
 		    return TCL_ERROR;
 		}
 	    
-		return PcnfsInfo(interp, argv[2], argv[4]);
+		return PcnfsInfo(interp, argv[2], (char*)argv[4]);
 		
 	    } else if (strcmp(argv[3], "list") == 0) {
 	        if (argc < 4 || argc > 5) {
@@ -1376,7 +1379,7 @@
 		    return TCL_ERROR;
 		}
 	    
-		return PcnfsList(interp, argv[2], argv[4]);
+		return PcnfsList(interp, argv[2], (char*)argv[4]);
 
 	    } else if (strcmp(argv[3], "status") == 0) {
 	        if (argc != 6) {
@@ -1386,7 +1389,7 @@
 		    return TCL_ERROR;
 		}
 	    
-		return PcnfsStatus(interp, argv[2], argv[4], argv[5]);
+		return PcnfsStatus(interp, argv[2], argv[4], (char*)argv[5]);
 	    
 	    } else if (strcmp (argv[3], "queue") == 0) {
 	        if (argc < 5 || argc > 6) {
@@ -1396,7 +1399,7 @@
 		    return TCL_ERROR;
 		}
 		
-		return PcnfsQueue(interp, argv[2], argv[4], argv[5]);
+		return PcnfsQueue(interp, argv[2], argv[4], (char*)argv[5]);
 	    
 	    } else {
 	        Tcl_AppendResult(interp, "bad option \"", argv[3],