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.