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
12 #include <sys/types.h>
25 if (tname
== NULL
) return 0;
27 /* Assume that tty devices are in /dev */
28 if (strncmp(tname
, "/dev/", 5) != 0)
29 return 0; /* Malformed tty name. */
32 /* Scan /etc/ttytab. */
34 while ((ttyp
= getttyent()) != NULL
)
36 if (strcmp(tname
, ttyp
->ty_name
) == 0)
49 * $PchHeader: /mount/hd2/minix/lib/misc/RCS/ttyslot.c,v 1.3 1994/12/22 13:49:12 philip Exp $