#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)ttyname.c 5.2 (Berkeley) %G%";
#endif LIBC_SCCS and not lint
* ttyname(f): return "/dev/ttyXX" which the the name of the
* tty belonging to file f.
* NULL if it is not a tty
static char dev
[] = "/dev/";
register struct direct
*db
;
if ((fsb
.st_mode
&S_IFMT
) != S_IFCHR
)
if ((df
= opendir(dev
)) == NULL
)
while ((db
= readdir(df
)) != NULL
) {
if (db
->d_ino
!= fsb
.st_ino
)
strcat(rbuf
, db
->d_name
);
if (stat(rbuf
, &tsb
) < 0)
if (tsb
.st_dev
== fsb
.st_dev
&& tsb
.st_ino
== fsb
.st_ino
) {