Install/uninstall are in place.
[super-star-trek.git] / os2.c
1 #include <stdlib.h>\r
2 #include <time.h>\r
3 #include <sys/ioctl.h>\r
4 #include <sys/termio.h>\r
5 \r
6 void randomize(void) {\r
7         srand((int)time(NULL));\r
8 }\r
9 \r
10 \r
11 int max(int a, int b) {\r
12         if (a > b) return a;\r
13         return b;\r
14 }\r
15 \r
16 int min(int a, int b) {\r
17         if (a < b) return a;\r
18         return b;\r
19 }\r
20 \r
21 int getch(void) {\r
22         char chbuf[1];\r
23         struct termio oldstate, newstate;\r
24     ioctl(0,TCGETA,&oldstate);\r
25         newstate = oldstate;\r
26         newgame.state.c_iflag = 0;\r
27         newgame.state.c_lflag = 0;\r
28         ioctl(0,TCSETA,&newstate);\r
29         read(0, &chbuf, 1);\r
30     ioctl(0,TCSETA,&oldstate);\r
31 }