blob: 37b01c46ed7af749953e774c6bfa039b53407bca [file] [log] [blame] [raw]
#include <windows.h>
#include <shared.h>
#include <errno.h>
int isatty(int fd) {
BY_HANDLE_FILE_INFORMATION_NEW information;
if(fd == -1) {
errno = EBADF;
return 0;
}
int r = !GetFileInformationByHandle((void *)fd, (BY_HANDLE_FILE_INFORMATION *)&information);
if(r) {
if(GetLastError() != ERROR_INVALID_FUNCTION) return 0;
SetLastError(0);
}
return r;
}