Sun Studio 12: Fortran Library Reference

1.4.52.2 isatty: Is this Unit a Terminal?

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  "