xref: /original-bsd/usr.bin/f77/libU77/ttynam_.c (revision a9c19d04)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)ttynam_.c	5.1	06/07/85
7  */
8 
9 /*
10  * Return name of tty port associated with lunit
11  *
12  * calling sequence:
13  *	character*19 string, ttynam
14  * 	string = ttynam (lunit)
15  * where:
16  *	the character string will be filled with the name of
17  *	the port, preceded with '/dev/', and blank padded.
18  *	(19 is the max length ever required)
19  */
20 
21 #include "../libI77/fiodefs.h"
22 
23 extern unit units[];
24 
25 ttynam_(name, strlen, lu)
26 char *name; long strlen; long *lu;
27 {
28 	char *t = NULL, *ttyname();
29 
30 	if (0 <= *lu && *lu < MXUNIT && units[*lu].ufd)
31 		t = ttyname(fileno(units[*lu].ufd));
32 	if (t == NULL)
33 		t = "";
34 	b_char(t, name, strlen);
35 }
36