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.
The function is called by:
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 |
The function isatty returns true or false depending on whether or not logical unit lunit is a terminal device or not.
The function is called by:
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 |
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 |
The output is:
terminal = T, name = "/dev/ttyp1 " |