summaryrefslogblamecommitdiffstats
path: root/prog/miška/d.c
blob: accdb31db1033b83912d2b7733ce0912f18f062f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                                    
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char ** argv) {
	if (argc != 3) {
		fprintf(stderr, "%s /dev/input/event3 'shell command' \n", argv[0]);
		return 1;
	}
	FILE * btn = fopen(argv[1], "rb");
	char buf[512];
	while (1) {
		fread(buf, 1, 16*6, btn);
		int ret = system(argv[2]);
		if (ret)
			return ret;
	}
	return 0;
}