comparison rvinterf/etm/main.c @ 182:13a0348ffce4

rvinterf/etm: checkpointing not-yet-compilable code
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 24 Nov 2013 06:59:09 +0000
parents
children fa7174faa9aa
comparison
equal deleted inserted replaced
181:6800c2cc8c51 182:13a0348ffce4
1 /*
2 * This module contains the main() function for fc-tmsh.
3 */
4
5 #include <sys/types.h>
6 #include <sys/errno.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <unistd.h>
10
11 char *socket_pathname = "/tmp/rvinterf_socket";
12 int ttyhacks, dflag;
13
14 int sock;
15
16 main(argc, argv)
17 char **argv;
18 {
19 extern char *optarg;
20 int c;
21 fd_set fds;
22
23 while ((c = getopt(argc, argv, "ds:")) != EOF)
24 switch (c) {
25 case 'd':
26 dflag++;
27 continue;
28 case 's':
29 socket_pathname = optarg;
30 continue;
31 case '?':
32 default:
33 exit(1);
34 }
35 ttyhacks = isatty(0) && !dflag;
36 init();
37 tty_init();
38 for (;;) {
39 FD_ZERO(&fds);
40 FD_SET(0, &fds);
41 FD_SET(sock, &fds);
42 c = select(sock+1, &fds, 0, 0, 0);
43 if (c < 0) {
44 if (errno == EINTR)
45 continue;
46 tty_cleanup();
47 perror("select");
48 exit(1);
49 }
50 if (FD_ISSET(0, &fds))
51 handle_tty_input();
52 if (FD_ISSET(sock, &fds))
53 handle_rvinterf_input();
54 fflush(stdout);
55 }
56 }