4 Return the index in the utmp file for the current user's terminal. The
5 current user's terminal is the first file descriptor in the range 0..2
6 for which ttyname() returns a name. The index is the line number in the
7 /etc/ttytab file. 0 will be returned in case of an error.
9 Created: Oct 11, 1992 by Philip Homburg
14 #include <sys/types.h>
24 if (slot
== 0) slot
= fttyslot(1);
25 if (slot
== 0) slot
= fttyslot(2);
37 if (tname
== NULL
) return 0;
39 /* Assume that tty devices are in /dev */
40 if (strncmp(tname
, "/dev/", 5) != 0)
41 return 0; /* Malformed tty name. */
44 /* Scan /etc/ttytab. */
46 while ((ttyp
= getttyent()) != NULL
)
48 if (strcmp(tname
, ttyp
->ty_name
) == 0)
61 * $PchHeader: /mount/hd2/minix/lib/misc/RCS/ttyslot.c,v 1.3 1994/12/22 13:49:12 philip Exp $