diff options
-rw-r--r-- | etc/waitstdin.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/etc/waitstdin.c b/etc/waitstdin.c new file mode 100644 index 0000000..cf05cfb --- /dev/null +++ b/etc/waitstdin.c @@ -0,0 +1,20 @@ +/* + * waitstdin -- wait for text on stdin + * $ cc -O2 -o waitstdin waitstdin.c + */ + +#include <sys/select.h> +#include <sys/wait.h> + +int +main() +{ + fd_set readfds; + + FD_ZERO(&readfds); + FD_SET(0, &readfds); + if(select(1, &readfds, NULL, NULL, NULL) == -1) + return 1; + + return 0; +} |