diff options
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -0,0 +1,20 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <sys/select.h> + +// utility to block until stdin has input +// public domain + +int main(int argc, char *argv[]) { + fd_set readset; + FD_ZERO(&readset); + FD_SET(STDIN_FILENO, &readset); + if (select(1, &readset, NULL, NULL, NULL) == -1) { + perror(argv[0]); + return EXIT_FAILURE; + } + + return 0; +} |