Rev 1419 | Rev 1469 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1419 | Rev 1466 | ||
---|---|---|---|
Line 47... | Line 47... | ||
47 | #include <string.h> |
47 | #include <string.h> |
48 | 48 | ||
49 | #include "input.h" |
49 | #include "input.h" |
50 | #include "tetris.h" |
50 | #include "tetris.h" |
51 | 51 | ||
- | 52 | #include <async.h> |
|
- | 53 | ||
52 | /* return true iff the given timeval is positive */ |
54 | /* return true iff the given timeval is positive */ |
53 | #define TV_POS(tv) \ |
55 | #define TV_POS(tv) \ |
54 | ((tv)->tv_sec > 0 || ((tv)->tv_sec == 0 && (tv)->tv_usec > 0)) |
56 | ((tv)->tv_sec > 0 || ((tv)->tv_sec == 0 && (tv)->tv_usec > 0)) |
55 | 57 | ||
56 | /* subtract timeval `sub' from `res' */ |
58 | /* subtract timeval `sub' from `res' */ |
Line 60... | Line 62... | ||
60 | if ((res)->tv_usec < 0) { \ |
62 | if ((res)->tv_usec < 0) { \ |
61 | (res)->tv_usec += 1000000; \ |
63 | (res)->tv_usec += 1000000; \ |
62 | (res)->tv_sec--; \ |
64 | (res)->tv_sec--; \ |
63 | } |
65 | } |
64 | 66 | ||
- | 67 | static aid_t getchar_inprog = 0; |
|
- | 68 | ||
65 | /* |
69 | /* |
66 | * Do a `read wait': select for reading from stdin, with timeout *tvp. |
70 | * Do a `read wait': select for reading from stdin, with timeout *tvp. |
67 | * On return, modify *tvp to reflect the amount of time spent waiting. |
71 | * On return, modify *tvp to reflect the amount of time spent waiting. |
68 | * It will be positive only if input appeared before the time ran out; |
72 | * It will be positive only if input appeared before the time ran out; |
69 | * otherwise it will be zero or perhaps negative. |
73 | * otherwise it will be zero or perhaps negative. |