summaryrefslogtreecommitdiffstats
path: root/tests/langbench/cat.l
blob: ca6ca1cda4e5349a4df74c2556e8bd4e51e38cef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void
main(int ac, string av[])
{
	string	buf;
	FILE	f;
	int	i;

	fconfigure("stdout", buffering:"full", translation:"binary");
	for (i = 1; i < ac; ++i) {
		unless (f = open(av[i], "rb")) continue;
		while (gets(f, &buf) >= 0) {
			// roughly 40% slower than puts
			// printf("%s\n", buf);
			puts(buf);
		}
		close(f);
	}
}