+#define WIN_X 800
+#define WIN_Y 600
+
+char getone()
+{
+ unsigned char c;
+ static char ring[2048];
+ static int prod = 0, cons = 0;
+ int oldcons;
+
+ if (prod == cons)
+ {
+ int r;
+ /* Try to read some. */
+ while ((r = read(0, &(ring[prod]), 2048-prod)) == 0)
+ usleep(250000);
+ prod = (prod + r) % 2048;
+ }
+ oldcons = cons;
+ cons = (cons + 1) % 2048;
+ return ring[oldcons];
+}