aboutsummaryrefslogtreecommitdiffstats
path: root/src/blind-flip.c
blob: e1b3b727a69c04302f5eda468221c2bb7ee55f60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* See LICENSE file for copyright and license details. */
#include "stream.h"
#include "util.h"

USAGE("")

int
main(int argc, char *argv[])
{
	struct stream stream;
	size_t ptr;
	char *buf;

	UNOFLAGS(argc);

	eopen_stream(&stream, NULL);
	echeck_dimensions(&stream, WIDTH | HEIGHT, NULL);
	fprint_stream_head(stdout, &stream);
	efflush(stdout, "<stdout>");
	buf = emalloc(stream.frame_size);

	while (eread_frame(&stream, buf))
		for (ptr = stream.frame_size; ptr;)
			ewriteall(STDOUT_FILENO, buf + (ptr -= stream.row_size),
				  stream.row_size, "<stdout>");
	/* ewriteall is faster than writev(3) and vmsplice(3) */

	free(buf);
	return 0;
}