summaryrefslogtreecommitdiff
path: root/tests/lib/libc/stdio/h_testnumbers.c
blob: 614ade8d230d5b3d8ce2ad87a0f4c1fff5347d0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <stdlib.h>
#include <err.h>

int
main(void)
{
	char line[1024];
	size_t i = 0;
	while (fgets(line, sizeof(line), stdin) != NULL) {
		if ((size_t)atoi(line) != i)
			errx(EXIT_FAILURE, "bad line \"%s\", expected %zu\n",
			    line, i);
		i++;
	}
	return EXIT_SUCCESS;
}