1 #include "lib.h" 2 #include <string.h> 3 #include <sys/types.h> 4 #include <sys/stat.h> 5 #include "sys9.h" 6 #include "dir.h" 7 8 int _isatty(int fd)9_isatty(int fd) 10 { 11 char buf[64]; 12 13 if(_FD2PATH(fd, buf, sizeof buf) < 0) 14 return 0; 15 16 /* might be /mnt/term/dev/cons */ 17 return strlen(buf) >= 9 && strcmp(buf+strlen(buf)-9, "/dev/cons") == 0; 18 } 19 20 /* The FD_ISTTY flag is set via _isatty in _fdsetup or open */ 21 int isatty(int fd)22isatty(int fd) 23 { 24 if(_fdinfo[fd].flags&FD_ISTTY) 25 return 1; 26 else 27 return 0; 28 } 29