* Copyright (c) 1984 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)ttyslot.c 5.2 (Berkeley) %G%";
#endif LIBC_SCCS and not lint
* Return the number of the slot in the utmp file
* corresponding to the current user: try for file 0, 1, 2.
* Definition is the line number in the /etc/ttys file.
register struct ttyent
*ty
;
if ((tp
= ttyname(0)) == NULL
&&
(tp
= ttyname(1)) == NULL
&&
(tp
= ttyname(2)) == NULL
)
if ((p
= rindex(tp
, '/')) == NULL
)
while ((ty
= getttyent()) != NULL
) {
if (strcmp(ty
->ty_name
, p
) == 0) {