9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22
23 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
24 /* All Rights Reserved */
25
26 /*
27 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
29 */
30
31 #pragma ident "%Z%%M% %I% %E% SMI"
32
33 /*
34 * interface( label )
35 * provide alternate definitions for the I/O functions through global
36 * interfaces.
37 */
38 #include "mt.h"
39 #include "uucp.h"
40 #include <unistd.h>
41
42 #ifdef TLI
43 #include <tiuser.h>
44 #endif /* TLI */
45
46 static void sethup(int);
47 static int restline(void);
48 static int usetup(int, int *, int *);
49 static int uteardown(int, int, int);
50
51 static ssize_t (*Read)() = read,
52 (*Write)() = write;
312 case T_IDLE: msg = (const char *)"T_IDLE"; break;
313 case T_OUTCON: msg = (const char *)"T_OUTCON"; break;
314 case T_INCON: msg = (const char *)"T_INCON"; break;
315 case T_DATAXFER: msg = (const char *)"T_DATAXFER"; break;
316 case T_OUTREL: msg = (const char *)"T_OUTREL"; break;
317 case T_INREL: msg = (const char *)"T_INREL"; break;
318 default: msg = NULL; break;
319 }
320 if (msg == NULL)
321 return;
322 DEBUG(5, "state is %s", msg);
323 switch (reason = t_look(fd)) {
324 case -1: msg = (const char *)""; break;
325 case 0: msg = (const char *)"NO ERROR"; break;
326 case T_LISTEN: msg = (const char *)"T_LISTEN"; break;
327 case T_CONNECT: msg = (const char *)"T_CONNECT"; break;
328 case T_DATA: msg = (const char *)"T_DATA"; break;
329 case T_EXDATA: msg = (const char *)"T_EXDATA"; break;
330 case T_DISCONNECT: msg = (const char *)"T_DISCONNECT"; break;
331 case T_ORDREL: msg = (const char *)"T_ORDREL"; break;
332 case T_ERROR: msg = (const char *)"T_ERROR"; break;
333 case T_UDERR: msg = (const char *)"T_UDERR"; break;
334 default: msg = (const char *)"UNKNOWN ERROR"; break;
335 }
336 DEBUG(4, " reason is %s\n", msg);
337
338 if (reason == T_DISCONNECT) {
339 struct t_discon *dropped;
340 if (((dropped =
341 /* LINTED pointer cast */
342 (struct t_discon *)t_alloc(fd, T_DIS, T_ALL)) == 0) ||
343 (t_rcvdis(fd, dropped) == -1)) {
344 if (dropped)
345 (void) t_free((char *)dropped, T_DIS);
346 return;
347 }
348 DEBUG(5, "disconnect reason #%d\n", dropped->reason);
349 (void) t_free((char *)dropped, T_DIS);
350 }
351 }
352 #endif /* TLIS */
|
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22
23 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
24 /* All Rights Reserved */
25
26 /*
27 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
29 * Copyright 2014 Gary Mills
30 */
31
32 /*
33 * interface( label )
34 * provide alternate definitions for the I/O functions through global
35 * interfaces.
36 */
37 #include "mt.h"
38 #include "uucp.h"
39 #include <unistd.h>
40
41 #ifdef TLI
42 #include <tiuser.h>
43 #endif /* TLI */
44
45 static void sethup(int);
46 static int restline(void);
47 static int usetup(int, int *, int *);
48 static int uteardown(int, int, int);
49
50 static ssize_t (*Read)() = read,
51 (*Write)() = write;
311 case T_IDLE: msg = (const char *)"T_IDLE"; break;
312 case T_OUTCON: msg = (const char *)"T_OUTCON"; break;
313 case T_INCON: msg = (const char *)"T_INCON"; break;
314 case T_DATAXFER: msg = (const char *)"T_DATAXFER"; break;
315 case T_OUTREL: msg = (const char *)"T_OUTREL"; break;
316 case T_INREL: msg = (const char *)"T_INREL"; break;
317 default: msg = NULL; break;
318 }
319 if (msg == NULL)
320 return;
321 DEBUG(5, "state is %s", msg);
322 switch (reason = t_look(fd)) {
323 case -1: msg = (const char *)""; break;
324 case 0: msg = (const char *)"NO ERROR"; break;
325 case T_LISTEN: msg = (const char *)"T_LISTEN"; break;
326 case T_CONNECT: msg = (const char *)"T_CONNECT"; break;
327 case T_DATA: msg = (const char *)"T_DATA"; break;
328 case T_EXDATA: msg = (const char *)"T_EXDATA"; break;
329 case T_DISCONNECT: msg = (const char *)"T_DISCONNECT"; break;
330 case T_ORDREL: msg = (const char *)"T_ORDREL"; break;
331 case T_UDERR: msg = (const char *)"T_UDERR"; break;
332 default: msg = (const char *)"UNKNOWN ERROR"; break;
333 }
334 DEBUG(4, " reason is %s\n", msg);
335
336 if (reason == T_DISCONNECT) {
337 struct t_discon *dropped;
338 if (((dropped =
339 /* LINTED pointer cast */
340 (struct t_discon *)t_alloc(fd, T_DIS, T_ALL)) == 0) ||
341 (t_rcvdis(fd, dropped) == -1)) {
342 if (dropped)
343 (void) t_free((char *)dropped, T_DIS);
344 return;
345 }
346 DEBUG(5, "disconnect reason #%d\n", dropped->reason);
347 (void) t_free((char *)dropped, T_DIS);
348 }
349 }
350 #endif /* TLIS */
|