xref: /original-bsd/lib/libc/gen/getttynam.c (revision 86d12f37)
13730b8d0Sdist /*
23730b8d0Sdist  * Copyright (c) 1983 Regents of the University of California.
33730b8d0Sdist  * All rights reserved.  The Berkeley software License Agreement
43730b8d0Sdist  * specifies the terms and conditions for redistribution.
53730b8d0Sdist  */
63730b8d0Sdist 
7*86d12f37Sdonn #if defined(LIBC_SCCS) && !defined(lint)
8*86d12f37Sdonn static char sccsid[] = "@(#)getttynam.c	5.2 (Berkeley) 03/09/86";
9*86d12f37Sdonn #endif LIBC_SCCS and not lint
1015f5185aSralph 
1115f5185aSralph #include <ttyent.h>
1215f5185aSralph 
1315f5185aSralph struct ttyent *
getttynam(tty)1415f5185aSralph getttynam(tty)
1515f5185aSralph 	char *tty;
1615f5185aSralph {
1715f5185aSralph 	register struct ttyent *t;
1815f5185aSralph 
1915f5185aSralph 	setttyent();
2015f5185aSralph 	while (t = getttyent()) {
2115f5185aSralph 		if (strcmp(tty, t->ty_name) == 0)
2215f5185aSralph 			break;
2315f5185aSralph 	}
2415f5185aSralph 	endttyent();
2515f5185aSralph 	return (t);
2615f5185aSralph }
27