ack/plat/msdos386/libsys/isatty.s
tkchia cba54b205b plat/msdos386: refactor, firm up, and optimize
- refactor code for transfer buffer reads/writes, real mode
   int 0x21 calls, and assembler segment declarations
 - define transfer buffer size in one place
 - beef up error checking for transfer buffer operations
   (prevent buffer overflows)
 - also optimize such operations to transfer dword by dword
   where feasible
2022-08-26 17:31:28 +00:00

31 lines
397 B
ArmAsm

#
! $Source$
! $State$
! $Revision$
#include "libsysasm.h"
! Say whether a given file descriptor number refers to a terminal.
.define _isatty
_isatty:
mov ebx, esp
mov ebx, 4(ebx)
o16 mov ax, 0x4400
int 0x21
jc error
testb dl, dl
jz not_tty
mov eax, 1
ret
not_tty:
mov (_errno), 25 ! ENOTTY
not_tty_2:
xor eax, eax
ret
error:
push eax
call __sys_seterrno
pop ecx
jmp not_tty_2