diff options
author | John Ankarström <john@ankarstrom.se> | 2021-07-27 00:55:07 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-07-27 00:55:07 +0200 |
commit | 3ec5f22f6808ada0356ab544f58d9d06816288fd (patch) | |
tree | cb2b1969df8162430907544b9eeb6eadcb7c29cf /etc | |
parent | 7211fe0f3a1d5724bef5e1462995fae6f2a3a343 (diff) | |
download | xutil-master.tar.gz |
Diffstat (limited to 'etc')
-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; +} |