TTYNAME(3) BSD Programmer's Manual TTYNAME(3) NNAAMMEE ttttyynnaammee, iissaattttyy, ttttyysslloott - get name of associated terminal (tty) from file descriptor SSYYNNOOPPSSIISS ##iinncclluuddee <> _c_h_a_r _* ttttyynnaammee(_i_n_t _f_d); _i_n_t iissaattttyy(_i_n_t _f_d); _i_n_t ttttyysslloott(); DDEESSCCRRIIPPTTIIOONN These functions operate on the system file descriptors for terminal type devices. These descriptors are not related to the standard I/O FILE type- def, but refer to the special device files found in _/_d_e_v and named _/_d_e_v_/_t_t_y_x_x and for which an entry exists in the initialization file _/_e_t_c_/_t_t_y_s_. (See ttys(5).) The iissaattttyy() function determines if the file descriptor _f_d refers to a valid terminal type device. The ttttyynnaammee() function gets the related device name of a file descriptor for which iissaattttyy() is true The ttttyysslloott() function fetches the current process' control terminal num- ber from the ttys(5) file entry. RREETTUURRNN VVAALLUUEESS The ttttyynnaammee() function returns the null terminated name if the device is found and iissaattttyy() is true; otherwise a NULL pointer is returned. The ttttyysslloott() function returns the unit number of the device file if found; otherwise the value zero is returned. FFIILLEESS /dev/* /etc/ttys SSEEEE AALLSSOO ioctl(2), ttys(5) HHIISSTTOORRYY A iissaattttyy(), ttttyynnaammee(), and ttttyysslloott() function appeared in Version 7 AT&T UNIX. BBUUGGSS The ttttyynnaammee() function leaves its result in an internal static object and returns a pointer to that object. Subsequent calls to ttttyynnaammee() will mod- ify the same object. 4.4BSD June 4, 1993 1