The physical device name of the terminal attached to the current
process (or its parents) is returned. If there is no terminal
available (for example in batch, network or detached processes)
the name is set to blanks and the length set to zero.
If the name is longer than the supplied character variable the
name is truncated but the length returned is the length of the
actual name.