函数 isatty 根据逻辑单元 lunit 是否为终端设备返回 true 或 false。
该函数的调用方式如下所示:
terminal = isatty( lunit ) |
|||
lunit |
INTEGER*4 |
输入 |
逻辑单元 |
返回值 |
LOGICAL*4 |
输出 |
terminal=true:是终端设备 terminal=false:不是终端设备 |
示例:确定 lunit 是否为 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 " |