summaryrefslogtreecommitdiff
path: root/block.c
blob: 40178d81c6d15db3cdbf20828cc8356c721ed3c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
}