f6dc6f6875
If it understands TIOCGETD, then it is a tty, else it isn't one. This seems to help Basic's input statement so I can see the prompt before I enter my input.
13 lines
277 B
C
13 lines
277 B
C
/*
|
|
* XXX - can't #include <sys/ioctl.h> because libcc.ansi and libsys
|
|
* both provide it, and we might find the wrong one.
|
|
*/
|
|
#define TIOCGETD 0x5424
|
|
int ioctl(int fd, unsigned long, ...);
|
|
|
|
int isatty(int fd)
|
|
{
|
|
int line_disc;
|
|
return 0 <= ioctl(fd, TIOCGETD, &line_disc);
|
|
}
|