Function: controlling-tty-p

Return non-nil if TERMINAL is the controlling tty of the Emacs process.

TERMINAL can be a terminal object, a frame, or nil (meaning the
selected frame's terminal). This function always returns nil if
TERMINAL is not on a tty device.

(fn &optional TERMINAL)