]> rtime.felk.cvut.cz Git - coffee/mt-apps.git/blob - mt_aio.c
no, one more rename
[coffee/mt-apps.git] / mt_aio.c
1 // merica terminal all in one
2 #include "mt_rfid.h"
3 #include "mt_server.h"
4 #include "signal_exit.h"
5
6 int main(int argc, char **argv)
7 {
8     struct ev_loop *loop = EV_DEFAULT;
9     int pipefd[2]; // read <- write
10     mt_rfid_t rfid;
11     mt_server_t server;
12
13     if (pipe(pipefd) == -1) {
14         perror("pipe");
15         return -1;
16     }
17
18     set_signal_exit(loop);
19
20     if (mt_rfid_init(&rfid, loop, pipefd[1]) != 0) {
21         return -1;
22     }
23
24     if (mt_server_init(&server, loop, pipefd[0]) != 0) {
25         return -2;
26     }
27
28     ev_run(loop, 0);
29
30     mt_server_deinit(&server);
31     mt_rfid_deinit(&rfid);
32
33     return 0;
34 }