1#include <fcntl.h>
2#include <stropts.h>
3
4int isastream(int fd) {
5    return fcntl(fd, F_GETFD) < 0 ? -1 : 0;
6}
7