ttynam and isatty handle terminal port names.
The function ttynam returns a blank padded path name of the terminal device associated with logical unit lunit.
CHARACTER ttynam*24 name = ttynam( lunit ) |
|||
---|---|---|---|
lunit |
INTEGER*4 |
Input |
Logical unit |
Return value |
character*n |
Output |
If nonblank returned: name=path name of device on lunit. Size n must be large enough for the longest path name. If empty string (all blanks) returned: lunit is not associated with a terminal device in the directory, /dev |
terminal = isatty( lunit ) |
|||
---|---|---|---|
lunit |
INTEGER*4 |
Input |
Logical unit |
Return value |
LOGICAL*4 |
Output |
terminal=true: It is a terminal device terminal=false: It is not a terminal device |
is called by:
Example: Determine if lunit is a tty:
character*12 name, ttynam INTEGER*4 lunit /5/ logical*4 isatty, terminal terminal = isatty( lunit ) name = ttynam( lunit ) write(*,*) 'terminal = ', terminal, ', name = "', name, '"' end
terminal = T, name = "/dev/ttyp1 "