1 /*-
2 * Copyright (c) 1980 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.proprietary.c%
6 */
7
8 #ifndef lint
9 static char sccsid[] = "@(#)ttynam_.c 5.2 (Berkeley) 04/12/91";
10 #endif /* not lint */
11
12 /*
13 * Return name of tty port associated with lunit
14 *
15 * calling sequence:
16 * character*19 string, ttynam
17 * string = ttynam (lunit)
18 * where:
19 * the character string will be filled with the name of
20 * the port, preceded with '/dev/', and blank padded.
21 * (19 is the max length ever required)
22 */
23
24 #include "../libI77/fiodefs.h"
25
26 extern unit units[];
27
ttynam_(name,strlen,lu)28 ttynam_(name, strlen, lu)
29 char *name; long strlen; long *lu;
30 {
31 char *t = NULL, *ttyname();
32
33 if (0 <= *lu && *lu < MXUNIT && units[*lu].ufd)
34 t = ttyname(fileno(units[*lu].ufd));
35 if (t == NULL)
36 t = "";
37 b_char(t, name, strlen);
38 }
39