xref: /csrg-svn/usr.bin/f77/libU77/ttynam_.c (revision 47944)
1*47944Sbostic /*-
2*47944Sbostic  * Copyright (c) 1980 The Regents of the University of California.
3*47944Sbostic  * All rights reserved.
44121Sdlw  *
5*47944Sbostic  * %sccs.include.proprietary.c%
623052Skre  */
723052Skre 
8*47944Sbostic #ifndef lint
9*47944Sbostic static char sccsid[] = "@(#)ttynam_.c	5.2 (Berkeley) 04/12/91";
10*47944Sbostic #endif /* not lint */
11*47944Sbostic 
1223052Skre /*
134121Sdlw  * Return name of tty port associated with lunit
144121Sdlw  *
154121Sdlw  * calling sequence:
164121Sdlw  *	character*19 string, ttynam
174121Sdlw  * 	string = ttynam (lunit)
184121Sdlw  * where:
194121Sdlw  *	the character string will be filled with the name of
204121Sdlw  *	the port, preceded with '/dev/', and blank padded.
214121Sdlw  *	(19 is the max length ever required)
224121Sdlw  */
234121Sdlw 
244121Sdlw #include "../libI77/fiodefs.h"
254121Sdlw 
264121Sdlw extern unit units[];
274121Sdlw 
ttynam_(name,strlen,lu)284121Sdlw ttynam_(name, strlen, lu)
294121Sdlw char *name; long strlen; long *lu;
304121Sdlw {
314121Sdlw 	char *t = NULL, *ttyname();
324121Sdlw 
334121Sdlw 	if (0 <= *lu && *lu < MXUNIT && units[*lu].ufd)
344121Sdlw 		t = ttyname(fileno(units[*lu].ufd));
354121Sdlw 	if (t == NULL)
364121Sdlw 		t = "";
374121Sdlw 	b_char(t, name, strlen);
384121Sdlw }
39