commit 93b56162416ae22921c17e317f92c952d79e495d
parent 918aebf431a91dee185836b1cc254e96c406d3e1
Author: Kyle Milz <kyle@0x30.net>
Date: Thu, 28 Jul 2016 19:28:44 -0600
src/term: break into 2 functions
Diffstat:
M | src/term_main.cc | | | 59 | +++++++++++++++++++++++++++++++++-------------------------- |
1 file changed, 33 insertions(+), 26 deletions(-)
diff --git a/src/term_main.cc b/src/term_main.cc
@@ -11,33 +11,9 @@
#include "af_unix.h"
#include "runtime_conn.h"
-int
-main(int argc, char *argv[])
+void
+draw_source(RuntimeProcess &conn)
{
- af_unix listen_sock;
- listen_sock.set_listen();
-
- initscr();
- if (has_colors() == FALSE) {
- endwin();
- printf("Your terminal does not support color\n");
- exit(1);
- }
- start_color();
- init_pair(1, COLOR_RED, COLOR_BLACK);
- init_pair(2, COLOR_YELLOW, COLOR_BLACK);
- init_pair(3, COLOR_GREEN, COLOR_BLACK);
- init_pair(4, COLOR_CYAN, COLOR_BLACK);
- init_pair(5, COLOR_MAGENTA, COLOR_BLACK);
-
- printw("Waiting for connection on /tmp/citrun.socket\n");
- refresh();
-
- af_unix *client = listen_sock.accept();
- if (client == NULL)
- errx(1, "client was NULL");
-
- RuntimeProcess conn(*client);
int fps = 0.;
int eps = 0;
@@ -167,6 +143,37 @@ main(int argc, char *argv[])
nanosleep(&sleep, NULL);
}
+}
+
+int
+main(int argc, char *argv[])
+{
+ af_unix listen_sock;
+ listen_sock.set_listen();
+
+ initscr();
+ if (has_colors() == FALSE) {
+ endwin();
+ printf("Your terminal does not support color\n");
+ exit(1);
+ }
+ start_color();
+ init_pair(1, COLOR_RED, COLOR_BLACK);
+ init_pair(2, COLOR_YELLOW, COLOR_BLACK);
+ init_pair(3, COLOR_GREEN, COLOR_BLACK);
+ init_pair(4, COLOR_CYAN, COLOR_BLACK);
+ init_pair(5, COLOR_MAGENTA, COLOR_BLACK);
+
+ printw("Waiting for connection on /tmp/citrun.socket\n");
+ refresh();
+
+ af_unix *client = listen_sock.accept();
+ if (client == NULL)
+ errx(1, "client was NULL");
+
+ RuntimeProcess conn(*client);
+ draw_source(conn);
+
endwin();
return 0;