summaryrefslogtreecommitdiff
path: root/devel/tcl-neo/files/patch-cute
blob: 3b08c4650d34018de9876d7bb9d3eaa0450161c8 (plain) (blame)
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
--- neoXcute.c	2000-04-20 09:16:00.000000000 -0400
+++ neoXcute.c	2010-01-18 01:13:14.000000000 -0500
@@ -45,5 +45,7 @@
 #endif
 
+#include <errno.h>
 #include <signal.h>
+#include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -55,8 +57,4 @@
 #include "neoXcute.h"
 
-extern char *strerror();
-
-extern int errno;
-
 static char cute_expectbuf[2048];
 
@@ -86,9 +84,15 @@
 int cute_bufindex = 0;
 
-void
-ppanic(s, fileName, lineNumber)
-char *s;
-char *fileName;
-int lineNumber;
+static Tcl_CmdProc Cute_Cmd, Cute_BreakLineCmd,
+    Cute_CaptureCmd, Cute_CloseLineCmd,
+    Cute_ConnectCmd, Cute_DisconnectCmd,
+    Cute_ExpectCmd, Cute_FlushLineCmd,
+    Cute_GetLineCmd, Cute_HangupCmd,
+    Cute_OpenLineCmd, Cute_ParityCmd,
+    Cute_SendCmd, Cute_SlowSendCmd,
+    Cute_SelectSpeedCmd;
+
+static void
+ppanic(const char *s, const char *fileName, int lineNumber)
 {
     fflush (stdout);
@@ -97,9 +101,9 @@
     perror (s);
     fflush (stderr);
-    panic ();
+    abort ();
 }
 
 /* dump a buffer of a specified length, printing preamble and exit text */
-void
+static void
 cute_dumpbuf(char *preamble, char *buf, int len, char *exitText)
 {
@@ -122,6 +126,6 @@
  * way we can timeout input, get stuff without a newline, etc, etc. */
 
-void
-cute_term_setup()
+static void
+cute_term_setup(void)
 {
     if (ioctl (0, TCGETA, &cute_orig_term_settings) < 0) {
@@ -157,6 +161,6 @@
 /* Put the user's terminal in a mode where we read as many characters as
  * are there but it returns in a tenth of a second. */
-void
-cute_timeout_single_char_mode()
+static void
+cute_timeout_single_char_mode(void)
 {
     if (cute_noControllingTerminal) panic("no controlling terminal");
@@ -168,6 +172,6 @@
 }
 
-void
-cute_orig_line_mode()
+static void
+cute_orig_line_mode(void)
 {
     if (ioctl (cute_linefd, TCSETA, &cute_orig_line_settings) < 0) {
@@ -176,6 +180,6 @@
 }
 
-void
-cute_async_line_mode()
+static void
+cute_async_line_mode(void)
 {
     cute_async_line_settings.c_cc[VTIME] = 0;
@@ -187,6 +191,6 @@
 
 /* Restore the user's terminal to its original settings */
-void
-cute_orig_term_mode()
+static void
+cute_orig_term_mode(void)
 {
     if (cute_noControllingTerminal) return;
@@ -198,6 +202,6 @@
 /* Put the user's terminal in a mode where we can read one character at a time.
  */
-void
-cute_single_char_mode()
+static void
+cute_single_char_mode(void)
 {
     if (cute_noControllingTerminal) panic ("no controlling terminal");
@@ -212,6 +216,6 @@
  * interval.  */
 
-int 
-cute_getachar()		/* return a char or -1 after timeout */
+static int 
+cute_getachar(void)	/* return a char or -1 after timeout */
 {
     char c;
@@ -226,6 +230,6 @@
 
 /* goodbye - clean up and dump out */
-void
-cute_comm_goodbye()
+static void
+cute_comm_goodbye(void)
 {
     cute_orig_term_mode();
@@ -241,5 +245,5 @@
 
 /* Cute_Nap - nap for the specified number of milliseconds */
-void
+static void
 Cute_Nap (int ms)
 {
@@ -269,10 +273,10 @@
  *----------------------------------------------------------------------
  */
-int
+static int
 Cute_OpenLineCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     if (argc != 2) {
@@ -338,8 +342,8 @@
 int
 Cute_CloseLineCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     if (argc != 1) {
@@ -365,8 +369,8 @@
 int
 Cute_ParityCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     int cflag;
@@ -432,11 +436,11 @@
 int
 Cute_SelectSpeedCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     int bps_bits;
-    static unsigned bits_per_second = 0;
+    static int bits_per_second = 0;
 
     if (argc == 1) {
@@ -472,5 +476,5 @@
 #endif
 
-    if (!TclX_StrToUnsigned (argv[1], 0, &bits_per_second)) {
+    if (Tcl_GetInt(interp, argv[1], &bits_per_second) != TCL_OK) {
 	Tcl_AppendResult (interp, argv[0], 
 	                  ": unrecognizable baud rate ", argv[1],
@@ -591,8 +595,6 @@
 }
 
-int
-cute_isline_up(interp, cmd)
-Tcl_Interp *interp;
-char *cmd;
+static int
+cute_isline_up(Tcl_Interp *interp, const char *cmd)
 {
     if (cute_line_up) return TCL_OK;
@@ -614,8 +616,8 @@
 int
 Cute_SendCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     int nocr = 0;
@@ -648,6 +650,6 @@
 }
 
-void
-cute_disconnect()
+static void
+cute_disconnect(void)
 {
     cute_interactive_connect = 0;
@@ -660,10 +662,8 @@
 */
 
-void
-cute_capture(buf, len)
-char *buf;
-int len;
+static void
+cute_capture(char *buf, int len)
 {
-    static previous_was_cr = 0;
+    static int previous_was_cr = 0;
     char c;
     static char cr = '\r';
@@ -706,8 +706,8 @@
 int
 Cute_CaptureCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     if (argc != 2) {
@@ -721,5 +721,5 @@
     }
 
-    if (Tcl_GetOpenFile (interp, argv[1], 1, 1, &cute_captureFileP) != TCL_OK) {
+    if (Tcl_GetOpenFile (interp, argv[1], 1, 1, (ClientData *)&cute_captureFileP) != TCL_OK) {
 	cute_captureFileP = NULL;
 	return TCL_ERROR;
@@ -741,8 +741,8 @@
 int
 Cute_ConnectCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     int c;
@@ -840,8 +840,8 @@
 int
 Cute_DisconnectCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     cute_disconnect ();
@@ -861,8 +861,8 @@
 int
 Cute_HangupCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     cute_comm_goodbye ();
@@ -882,8 +882,8 @@
 int
 Cute_SlowSendCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     int j, len;
@@ -944,8 +944,8 @@
 int
 Cute_GetLineCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     int newlineIndex;
@@ -962,5 +962,5 @@
 
     if (argc == 3) {
-        if (!TclX_StrToInt (argv[2], 10, &timeout_seconds)) {
+        if (Tcl_GetInt(interp, argv[2], &timeout_seconds) != TCL_OK) {
 	    Tcl_AppendResult(interp, "bad timeout arg: ", argv[0], 
 			     " varName ", argv[2], (char *)NULL);
@@ -1068,8 +1068,8 @@
 int
 Cute_ExpectCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     int timeout_seconds;
@@ -1101,5 +1101,5 @@
     }
 
-    if (!TclX_StrToInt (argv[1], 10, &timeout_seconds)) {
+    if (Tcl_GetInt(interp, argv[1], &timeout_seconds) != TCL_OK) {
         Tcl_AppendResult (interp, "bad timeout value: ", argv[0],
             ": ", argv[1], (char *)NULL);
@@ -1218,8 +1218,8 @@
 int
 Cute_FlushLineCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     int flusharg;
@@ -1243,5 +1243,5 @@
     if (cute_isline_up(interp, argv[0]) == TCL_ERROR) return TCL_ERROR;
 
-    if (ioctl(cute_linefd, TCFLSH, (struct termio *) flusharg) < 0) {
+    if (ioctl(cute_linefd, TCFLSH, flusharg) < 0) {
         perror("flushing remote line");
     }
@@ -1260,8 +1260,8 @@
 int
 Cute_BreakLineCmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     if (cute_isline_up(interp, argv[0]) == TCL_ERROR) return TCL_ERROR;
@@ -1274,6 +1274,6 @@
 
 struct cuteCommandStruct {
-    const char *name;
-    int (*function)();
+    const char	*name;
+    Tcl_CmdProc	*function;
 };
 
@@ -1298,8 +1298,8 @@
 int
 Cute_Cmd(clientData, interp, argc, argv)
-    char *clientData;
+    void *clientData;
     Tcl_Interp *interp;
     int argc;
-    char **argv;
+    const char *argv[];
 {
     struct cuteCommandStruct *cmdptr = cuteCommands;