2022-08-07 20:10:08 +00:00
|
|
|
#
|
|
|
|
! $Source$
|
|
|
|
! $State$
|
|
|
|
! $Revision$
|
|
|
|
|
2022-08-26 17:20:56 +00:00
|
|
|
#include "libsysasm.h"
|
2022-08-07 20:10:08 +00:00
|
|
|
|
|
|
|
! Say whether a given file descriptor number refers to a terminal.
|
|
|
|
|
|
|
|
.define _isatty
|
|
|
|
_isatty:
|
2022-08-18 22:08:57 +00:00
|
|
|
mov ebx, esp
|
2022-08-17 20:34:06 +00:00
|
|
|
mov ebx, 4(ebx)
|
|
|
|
o16 mov ax, 0x4400
|
2022-08-07 20:10:08 +00:00
|
|
|
int 0x21
|
|
|
|
jc error
|
|
|
|
testb dl, dl
|
|
|
|
jz not_tty
|
2022-08-17 20:34:06 +00:00
|
|
|
mov eax, 1
|
2022-08-07 20:10:08 +00:00
|
|
|
ret
|
|
|
|
not_tty:
|
|
|
|
mov (_errno), 25 ! ENOTTY
|
|
|
|
not_tty_2:
|
2022-08-17 20:34:06 +00:00
|
|
|
xor eax, eax
|
2022-08-07 20:10:08 +00:00
|
|
|
ret
|
|
|
|
error:
|
2022-08-17 20:34:06 +00:00
|
|
|
push eax
|
2022-08-07 20:10:08 +00:00
|
|
|
call __sys_seterrno
|
2022-08-17 20:34:06 +00:00
|
|
|
pop ecx
|
2022-08-07 20:10:08 +00:00
|
|
|
jmp not_tty_2
|