diff options
Diffstat (limited to 'prog/miška/d.c')
-rw-r--r-- | prog/miška/d.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/prog/miška/d.c b/prog/miška/d.c new file mode 100644 index 0000000..accdb31 --- /dev/null +++ b/prog/miška/d.c @@ -0,0 +1,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; +} |