Fortran Library Reference

isatty: Is this Unit a Terminal?

The function

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

The output is:


 terminal = T, name = "/dev/ttyp1  "