2 Proprietary Rand Corporation
, 1981.
3 Further distribution of
this software
4 subject to the terms of the Rand
9 /* this subr returns owner of tty attached to file handle # 2 */
10 /* on harv/unix, this may not be the real uid, because */
11 /* we have the command "alias" which spawns a sub-shell with */
12 /* a new real uid. luid (login uid) is used by the harvard shell */
13 /* to find the "save.txt" file (via getpath(getluid())) for $a - $z */
14 /* shell macros, and elsewhere by certain accounting routines. */
19 if (fstat(2,&ibuf
) < 0 &&
20 fstat(1,&ibuf
) < 0) return(getruid());
21 if ((ibuf
.i_mode
& IFMT
) != IFCHR
) return(getruid());
22 return(ibuf
.i_uid
&0377);