* 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/";
if ((fsb
.st_mode
&S_IFMT
) != S_IFCHR
)
if ((df
= open(dev
, 0)) < 0)
while (read(df
, (char *)&db
, sizeof(db
)) == sizeof(db
)) {
if (db
.d_ino
!= fsb
.st_ino
)
if (stat(rbuf
, &tsb
) < 0)
if (tsb
.st_dev
==fsb
.st_dev
&& tsb
.st_ino
==fsb
.st_ino
) {