Index: console/console.c
===================================================================
--- console/console.c	(revision b27a97bb30fc0f831ab37f52c45321ec3d904ca4)
+++ console/console.c	(revision c0e674a238ff74e58b8536aa4cc81699ae586e95)
@@ -39,4 +39,9 @@
 #include <async.h>
 
+static void sysput(char c)
+{
+	__SYSCALL3(SYS_IO, 1, &c, 1);
+
+}
 //#define CONSOLE_COUNT VFB_CONNECTIONS
 #define CONSOLE_COUNT 6
@@ -157,8 +162,7 @@
 		case CONSOLE_GETCHAR:
 			/* FIXME: Only temporary solution until request storage will be created  */
-			
 			while (!keybuffer_pop(&(connections[active_client].keybuffer), (char *)&arg1)) {
 				/* FIXME: buffer empty -> store request */
-				usleep(10000);
+				async_usleep(100000);
 			};
 			
Index: libc/generic/async.c
===================================================================
--- libc/generic/async.c	(revision b27a97bb30fc0f831ab37f52c45321ec3d904ca4)
+++ libc/generic/async.c	(revision c0e674a238ff74e58b8536aa4cc81699ae586e95)
@@ -165,4 +165,12 @@
 	return 0;
 }
+static int tv_gteq(struct timeval *tv1, struct timeval *tv2)
+{
+	if (tv1->tv_sec > tv2->tv_sec)
+		return 1;
+	if (tv1->tv_sec == tv2->tv_sec && tv1->tv_usec >= tv2->tv_usec)
+		return 1;
+	return 0;
+}
 
 /* Hash table functions */
@@ -241,4 +249,6 @@
 	connection_t *conn;
 	
+	assert(PS_connection);
+
 	futex_down(&async_futex);
 
@@ -436,5 +446,5 @@
 			amsg = list_get_instance(timeout_list.next,amsg_t,link);
 			gettimeofday(&tv,NULL);
-			if (tv_gt(&tv, &amsg->expires)) {
+			if (tv_gteq(&tv, &amsg->expires)) {
 				handle_expired_timeouts();
 				continue;
@@ -589,5 +599,5 @@
 	while (tmp != &timeout_list) {
 		cur = list_get_instance(tmp, amsg_t, link);
-		if (tv_gt(&cur->expires, &msg->expires))
+		if (tv_gteq(&cur->expires, &msg->expires))
 			break;
 		tmp = tmp->next;
Index: tetris/Makefile
===================================================================
--- tetris/Makefile	(revision b27a97bb30fc0f831ab37f52c45321ec3d904ca4)
+++ tetris/Makefile	(revision c0e674a238ff74e58b8536aa4cc81699ae586e95)
@@ -6,5 +6,5 @@
 
 OUTPUT = tetris
-SOURCES = shapes.c tetris.c scores.c input.c screen.c
+SOURCES = shapes.c scores.c input.c tetris.c screen.c
 OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
 
Index: tetris/input.c
===================================================================
--- tetris/input.c	(revision b27a97bb30fc0f831ab37f52c45321ec3d904ca4)
+++ tetris/input.c	(revision c0e674a238ff74e58b8536aa4cc81699ae586e95)
@@ -50,4 +50,6 @@
 #include "tetris.h"
 
+#include <async.h>
+
 /* return true iff the given timeval is positive */
 #define	TV_POS(tv) \
@@ -62,4 +64,6 @@
 		(res)->tv_sec--; \
 	}
+
+static aid_t getchar_inprog = 0;
 
 /*
Index: tetris/scores.c
===================================================================
--- tetris/scores.c	(revision b27a97bb30fc0f831ab37f52c45321ec3d904ca4)
+++ tetris/scores.c	(revision c0e674a238ff74e58b8536aa4cc81699ae586e95)
@@ -44,21 +44,21 @@
  */
 #include <errno.h>
-#include <err.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <term.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+/* #include <err.h> */
+/* #include <fcntl.h> */
+/* #include <pwd.h> */
+/* #include <stdio.h> */
+/* #include <stdlib.h> */
+/* #include <string.h> */
+/* #include <time.h> */
+/* #include <term.h> */
+/* #include <unistd.h> */
+/* #include <sys/param.h> */
+/* #include <sys/stat.h> */
+/* #include <sys/types.h> */
 
 #include "pathnames.h"
 #include "screen.h"
+#include "tetris.h"
 #include "scores.h"
-#include "tetris.h"
 
 /*
@@ -73,14 +73,14 @@
 #define	NLEVELS (MAXLEVEL + 1)
 
-static time_t now;
-static int nscores;
-static int gotscores;
-static struct highscore scores[NUMSPOTS];
-
-static int checkscores(struct highscore *, int);
-static int cmpscores(const void *, const void *);
-static void getscores(FILE **);
-static void printem(int, int, struct highscore *, int, const char *);
-static char *thisuser(void);
+/* static time_t now; */
+/* static int nscores; */
+/* static int gotscores; */
+/* static struct highscore scores[NUMSPOTS]; */
+
+/* static int checkscores(struct highscore *, int); */
+/* static int cmpscores(const void *, const void *); */
+/* static void getscores(FILE **); */
+/* static void printem(int, int, struct highscore *, int, const char *); */
+/* static char *thisuser(void); */
 
 /*
@@ -93,121 +93,123 @@
  * Note, we assume closing the stdio file releases the lock.
  */
-static void
-getscores(FILE **fpp)
-{
-	int sd, mint, lck, mask, i;
-	char *mstr, *human;
-	FILE *sf;
-
-	if (fpp != NULL) {
-		mint = O_RDWR | O_CREAT;
-		mstr = "r+";
-		human = "read/write";
-		lck = LOCK_EX;
-	} else {
-		mint = O_RDONLY;
-		mstr = "r";
-		human = "reading";
-		lck = LOCK_SH;
-	}
-	setegid(egid);
-	mask = umask(S_IWOTH);
-	sd = open(_PATH_SCOREFILE, mint, 0666);
-	(void)umask(mask);
-	setegid(gid);
-	if (sd < 0) {
-		if (fpp == NULL) {
-			nscores = 0;
-			return;
-		}
-		err(1, "cannot open %s for %s", _PATH_SCOREFILE, human);
-	}
-	setegid(egid);
-	if ((sf = fdopen(sd, mstr)) == NULL)
-		err(1, "cannot fdopen %s for %s", _PATH_SCOREFILE, human);
-	setegid(gid);
-
-	/*
-	 * Grab a lock.
-	 */
-	if (flock(sd, lck))
-		warn("warning: score file %s cannot be locked",
-		    _PATH_SCOREFILE);
-
-	nscores = fread(scores, sizeof(scores[0]), MAXHISCORES, sf);
-	if (ferror(sf))
-		err(1, "error reading %s", _PATH_SCOREFILE);
-	for (i = 0; i < nscores; i++)
-		if (scores[i].hs_level < MINLEVEL ||
-		    scores[i].hs_level > MAXLEVEL)
-			errx(1, "scorefile %s corrupt", _PATH_SCOREFILE);
-
-	if (fpp)
-		*fpp = sf;
-	else
-		(void)fclose(sf);
-}
+/* static void */
+/* getscores(FILE **fpp) */
+/* { */
+/* 	int sd, mint, lck, mask, i; */
+/* 	char *mstr, *human; */
+/* 	FILE *sf; */
+
+/* 	if (fpp != NULL) { */
+/* 		mint = O_RDWR | O_CREAT; */
+/* 		mstr = "r+"; */
+/* 		human = "read/write"; */
+/* 		lck = LOCK_EX; */
+/* 	} else { */
+/* 		mint = O_RDONLY; */
+/* 		mstr = "r"; */
+/* 		human = "reading"; */
+/* 		lck = LOCK_SH; */
+/* 	} */
+/* 	setegid(egid); */
+/* 	mask = umask(S_IWOTH); */
+/* 	sd = open(_PATH_SCOREFILE, mint, 0666); */
+/* 	(void)umask(mask); */
+/* 	setegid(gid); */
+/* 	if (sd < 0) { */
+/* 		if (fpp == NULL) { */
+/* 			nscores = 0; */
+/* 			return; */
+/* 		} */
+/* 		err(1, "cannot open %s for %s", _PATH_SCOREFILE, human); */
+/* 	} */
+/* 	setegid(egid); */
+/* 	if ((sf = fdopen(sd, mstr)) == NULL) */
+/* 		err(1, "cannot fdopen %s for %s", _PATH_SCOREFILE, human); */
+/* 	setegid(gid); */
+
+/* 	/\* */
+/* 	 * Grab a lock. */
+/* 	 *\/ */
+/* 	if (flock(sd, lck)) */
+/* 		warn("warning: score file %s cannot be locked", */
+/* 		    _PATH_SCOREFILE); */
+
+/* 	nscores = fread(scores, sizeof(scores[0]), MAXHISCORES, sf); */
+/* 	if (ferror(sf)) */
+/* 		err(1, "error reading %s", _PATH_SCOREFILE); */
+/* 	for (i = 0; i < nscores; i++) */
+/* 		if (scores[i].hs_level < MINLEVEL || */
+/* 		    scores[i].hs_level > MAXLEVEL) */
+/* 			errx(1, "scorefile %s corrupt", _PATH_SCOREFILE); */
+
+/* 	if (fpp) */
+/* 		*fpp = sf; */
+/* 	else */
+/* 		(void)fclose(sf); */
+/* } */
 
 void
 savescore(int level)
 {
-	struct highscore *sp;
-	int i;
-	int change;
-	FILE *sf;
-	const char *me;
-
-	getscores(&sf);
-	gotscores = 1;
-	(void)time(&now);
-
-	/*
-	 * Allow at most one score per person per level -- see if we
-	 * can replace an existing score, or (easiest) do nothing.
-	 * Otherwise add new score at end (there is always room).
-	 */
-	change = 0;
-	me = thisuser();
-	for (i = 0, sp = &scores[0]; i < nscores; i++, sp++) {
-		if (sp->hs_level != level || strcmp(sp->hs_name, me) != 0)
-			continue;
-		if (score > sp->hs_score) {
-			(void)printf("%s bettered %s %d score of %d!\n",
-			    "\nYou", "your old level", level,
-			    sp->hs_score * sp->hs_level);
-			sp->hs_score = score;	/* new score */
-			sp->hs_time = now;	/* and time */
-			change = 1;
-		} else if (score == sp->hs_score) {
-			(void)printf("%s tied %s %d high score.\n",
-			    "\nYou", "your old level", level);
-			sp->hs_time = now;	/* renew it */
-			change = 1;		/* gotta rewrite, sigh */
-		} /* else new score < old score: do nothing */
-		break;
-	}
-	if (i >= nscores) {
-		strlcpy(sp->hs_name, me, sizeof sp->hs_name);
-		sp->hs_level = level;
-		sp->hs_score = score;
-		sp->hs_time = now;
-		nscores++;
-		change = 1;
-	}
-
-	if (change) {
-		/*
-		 * Sort & clean the scores, then rewrite.
-		 */
-		nscores = checkscores(scores, nscores);
-		rewind(sf);
-		if (fwrite(scores, sizeof(*sp), nscores, sf) != nscores ||
-		    fflush(sf) == EOF)
-			warnx("error writing %s: %s\n\t-- %s",
-			    _PATH_SCOREFILE, strerror(errno),
-			    "high scores may be damaged");
-	}
-	(void)fclose(sf);	/* releases lock */
+	return;
 }
+/* 	struct highscore *sp; */
+/* 	int i; */
+/* 	int change; */
+/* 	FILE *sf; */
+/* 	const char *me; */
+
+/* 	getscores(&sf); */
+/* 	gotscores = 1; */
+/* 	(void)time(&now); */
+
+/* 	/\* */
+/* 	 * Allow at most one score per person per level -- see if we */
+/* 	 * can replace an existing score, or (easiest) do nothing. */
+/* 	 * Otherwise add new score at end (there is always room). */
+/* 	 *\/ */
+/* 	change = 0; */
+/* 	me = thisuser(); */
+/* 	for (i = 0, sp = &scores[0]; i < nscores; i++, sp++) { */
+/* 		if (sp->hs_level != level || strcmp(sp->hs_name, me) != 0) */
+/* 			continue; */
+/* 		if (score > sp->hs_score) { */
+/* 			(void)printf("%s bettered %s %d score of %d!\n", */
+/* 			    "\nYou", "your old level", level, */
+/* 			    sp->hs_score * sp->hs_level); */
+/* 			sp->hs_score = score;	/\* new score *\/ */
+/* 			sp->hs_time = now;	/\* and time *\/ */
+/* 			change = 1; */
+/* 		} else if (score == sp->hs_score) { */
+/* 			(void)printf("%s tied %s %d high score.\n", */
+/* 			    "\nYou", "your old level", level); */
+/* 			sp->hs_time = now;	/\* renew it *\/ */
+/* 			change = 1;		/\* gotta rewrite, sigh *\/ */
+/* 		} /\* else new score < old score: do nothing *\/ */
+/* 		break; */
+/* 	} */
+/* 	if (i >= nscores) { */
+/* 		strlcpy(sp->hs_name, me, sizeof sp->hs_name); */
+/* 		sp->hs_level = level; */
+/* 		sp->hs_score = score; */
+/* 		sp->hs_time = now; */
+/* 		nscores++; */
+/* 		change = 1; */
+/* 	} */
+
+/* 	if (change) { */
+/* 		/\* */
+/* 		 * Sort & clean the scores, then rewrite. */
+/* 		 *\/ */
+/* 		nscores = checkscores(scores, nscores); */
+/* 		rewind(sf); */
+/* 		if (fwrite(scores, sizeof(*sp), nscores, sf) != nscores || */
+/* 		    fflush(sf) == EOF) */
+/* 			warnx("error writing %s: %s\n\t-- %s", */
+/* 			    _PATH_SCOREFILE, strerror(errno), */
+/* 			    "high scores may be damaged"); */
+/* 	} */
+/* 	(void)fclose(sf);	/\* releases lock *\/ */
+/* } */
 
 /*
@@ -215,24 +217,24 @@
  * The result is always trimmed to fit in a score.
  */
-static char *
-thisuser(void)
-{
-	const char *p;
-	struct passwd *pw;
-	static char u[sizeof(scores[0].hs_name)];
-
-	if (u[0])
-		return (u);
-	p = getlogin();
-	if (p == NULL || *p == '\0') {
-		pw = getpwuid(getuid());
-		if (pw != NULL)
-			p = pw->pw_name;
-		else
-			p = "  ???";
-	}
-	strlcpy(u, p, sizeof(u));
-	return (u);
-}
+/* static char * */
+/* thisuser(void) */
+/* { */
+/* 	const char *p; */
+/* 	struct passwd *pw; */
+/* 	static char u[sizeof(scores[0].hs_name)]; */
+
+/* 	if (u[0]) */
+/* 		return (u); */
+/* 	p = getlogin(); */
+/* 	if (p == NULL || *p == '\0') { */
+/* 		pw = getpwuid(getuid()); */
+/* 		if (pw != NULL) */
+/* 			p = pw->pw_name; */
+/* 		else */
+/* 			p = "  ???"; */
+/* 	} */
+/* 	strlcpy(u, p, sizeof(u)); */
+/* 	return (u); */
+/* } */
 
 /*
@@ -242,23 +244,23 @@
  * listed first in the highscore file.
  */
-static int
-cmpscores(const void *x, const void *y)
-{
-	const struct highscore *a, *b;
-	long l;
-
-	a = x;
-	b = y;
-	l = (long)b->hs_level * b->hs_score - (long)a->hs_level * a->hs_score;
-	if (l < 0)
-		return (-1);
-	if (l > 0)
-		return (1);
-	if (a->hs_time < b->hs_time)
-		return (-1);
-	if (a->hs_time > b->hs_time)
-		return (1);
-	return (0);
-}
+/* static int */
+/* cmpscores(const void *x, const void *y) */
+/* { */
+/* 	const struct highscore *a, *b; */
+/* 	long l; */
+
+/* 	a = x; */
+/* 	b = y; */
+/* 	l = (long)b->hs_level * b->hs_score - (long)a->hs_level * a->hs_score; */
+/* 	if (l < 0) */
+/* 		return (-1); */
+/* 	if (l > 0) */
+/* 		return (1); */
+/* 	if (a->hs_time < b->hs_time) */
+/* 		return (-1); */
+/* 	if (a->hs_time > b->hs_time) */
+/* 		return (1); */
+/* 	return (0); */
+/* } */
 
 /*
@@ -271,68 +273,68 @@
  * Caveat:  the highest score on each level is always kept.
  */
-static int
-checkscores(struct highscore *hs, int num)
-{
-	struct highscore *sp;
-	int i, j, k, numnames;
-	int levelfound[NLEVELS];
-	struct peruser {
-		char *name;
-		int times;
-	} count[NUMSPOTS];
-	struct peruser *pu;
-
-	/*
-	 * Sort so that highest totals come first.
-	 *
-	 * levelfound[i] becomes set when the first high score for that
-	 * level is encountered.  By definition this is the highest score.
-	 */
-	qsort((void *)hs, nscores, sizeof(*hs), cmpscores);
-	for (i = MINLEVEL; i < NLEVELS; i++)
-		levelfound[i] = 0;
-	numnames = 0;
-	for (i = 0, sp = hs; i < num;) {
-		/*
-		 * This is O(n^2), but do you think we care?
-		 */
-		for (j = 0, pu = count; j < numnames; j++, pu++)
-			if (strcmp(sp->hs_name, pu->name) == 0)
-				break;
-		if (j == numnames) {
-			/*
-			 * Add new user, set per-user count to 1.
-			 */
-			pu->name = sp->hs_name;
-			pu->times = 1;
-			numnames++;
-		} else {
-			/*
-			 * Two ways to keep this score:
-			 * - Not too many (per user), still has acct, &
-			 *	score not dated; or
-			 * - High score on this level.
-			 */
-			if ((pu->times < MAXSCORES &&
-			     getpwnam(sp->hs_name) != NULL &&
-			     sp->hs_time + EXPIRATION >= now) ||
-			    levelfound[sp->hs_level] == 0)
-				pu->times++;
-			else {
-				/*
-				 * Delete this score, do not count it,
-				 * do not pass go, do not collect $200.
-				 */
-				num--;
-				for (k = i; k < num; k++)
-					hs[k] = hs[k + 1];
-				continue;
-			}
-		}
-		levelfound[sp->hs_level] = 1;
-		i++, sp++;
-	}
-	return (num > MAXHISCORES ? MAXHISCORES : num);
-}
+/* static int */
+/* checkscores(struct highscore *hs, int num) */
+/* { */
+/* 	struct highscore *sp; */
+/* 	int i, j, k, numnames; */
+/* 	int levelfound[NLEVELS]; */
+/* 	struct peruser { */
+/* 		char *name; */
+/* 		int times; */
+/* 	} count[NUMSPOTS]; */
+/* 	struct peruser *pu; */
+
+/* 	/\* */
+/* 	 * Sort so that highest totals come first. */
+/* 	 * */
+/* 	 * levelfound[i] becomes set when the first high score for that */
+/* 	 * level is encountered.  By definition this is the highest score. */
+/* 	 *\/ */
+/* 	qsort((void *)hs, nscores, sizeof(*hs), cmpscores); */
+/* 	for (i = MINLEVEL; i < NLEVELS; i++) */
+/* 		levelfound[i] = 0; */
+/* 	numnames = 0; */
+/* 	for (i = 0, sp = hs; i < num;) { */
+/* 		/\* */
+/* 		 * This is O(n^2), but do you think we care? */
+/* 		 *\/ */
+/* 		for (j = 0, pu = count; j < numnames; j++, pu++) */
+/* 			if (strcmp(sp->hs_name, pu->name) == 0) */
+/* 				break; */
+/* 		if (j == numnames) { */
+/* 			/\* */
+/* 			 * Add new user, set per-user count to 1. */
+/* 			 *\/ */
+/* 			pu->name = sp->hs_name; */
+/* 			pu->times = 1; */
+/* 			numnames++; */
+/* 		} else { */
+/* 			/\* */
+/* 			 * Two ways to keep this score: */
+/* 			 * - Not too many (per user), still has acct, & */
+/* 			 *	score not dated; or */
+/* 			 * - High score on this level. */
+/* 			 *\/ */
+/* 			if ((pu->times < MAXSCORES && */
+/* 			     getpwnam(sp->hs_name) != NULL && */
+/* 			     sp->hs_time + EXPIRATION >= now) || */
+/* 			    levelfound[sp->hs_level] == 0) */
+/* 				pu->times++; */
+/* 			else { */
+/* 				/\* */
+/* 				 * Delete this score, do not count it, */
+/* 				 * do not pass go, do not collect $200. */
+/* 				 *\/ */
+/* 				num--; */
+/* 				for (k = i; k < num; k++) */
+/* 					hs[k] = hs[k + 1]; */
+/* 				continue; */
+/* 			} */
+/* 		} */
+/* 		levelfound[sp->hs_level] = 1; */
+/* 		i++, sp++; */
+/* 	} */
+/* 	return (num > MAXHISCORES ? MAXHISCORES : num); */
+/* } */
 
 /*
@@ -346,98 +348,101 @@
 showscores(int level)
 {
-	struct highscore *sp;
-	int i, n, c;
-	const char *me;
-	int levelfound[NLEVELS];
-
-	if (!gotscores)
-		getscores((FILE **)NULL);
-	(void)printf("\n\t\t    Tetris High Scores\n");
-
-	/*
-	 * If level == 0, the person has not played a game but just asked for
-	 * the high scores; we do not need to check for printing in highlight
-	 * mode.  If SOstr is null, we can't do highlighting anyway.
-	 */
-	me = level && SOstr ? thisuser() : NULL;
-
-	/*
-	 * Set times to 0 except for high score on each level.
-	 */
-	for (i = MINLEVEL; i < NLEVELS; i++)
-		levelfound[i] = 0;
-	for (i = 0, sp = scores; i < nscores; i++, sp++) {
-		if (levelfound[sp->hs_level])
-			sp->hs_time = 0;
-		else {
-			sp->hs_time = 1;
-			levelfound[sp->hs_level] = 1;
-		}
-	}
-
-	/*
-	 * Page each screenful of scores.
-	 */
-	for (i = 0, sp = scores; i < nscores; sp += n) {
-		n = 20;
-		if (i + n > nscores)
-			n = nscores - i;
-		printem(level, i + 1, sp, n, me);
-		if ((i += n) < nscores) {
-			(void)printf("\nHit RETURN to continue.");
-			(void)fflush(stdout);
-			while ((c = getchar()) != '\n')
-				if (c == EOF)
-					break;
-			(void)printf("\n");
-		}
-	}
-
-	if (nscores == 0)
-		printf("\t\t\t      - none to date.\n");
+	return;
 }
 
-static void
-printem(int level, int offset, struct highscore *hs, int n, const char *me)
-{
-	struct highscore *sp;
-	int row, highlight, i;
-	char buf[100];
-#define	TITLE "Rank  Score   Name                          (points/level)"
-#define	TITL2 "=========================================================="
-
-	printf("%s\n%s\n", TITLE, TITL2);
-
-	highlight = 0;
-
-	for (row = 0; row < n; row++) {
-		sp = &hs[row];
-		(void)snprintf(buf, sizeof(buf),
-		    "%3d%c %6d  %-31s (%6d on %d)\n",
-		    row + offset, sp->hs_time ? '*' : ' ',
-		    sp->hs_score * sp->hs_level,
-		    sp->hs_name, sp->hs_score, sp->hs_level);
-		/* Print leaders every three lines */
-		if ((row + 1) % 3 == 0) {
-			for (i = 0; i < sizeof(buf); i++)
-				if (buf[i] == ' ')
-					buf[i] = '_';
-		}
-		/*
-		 * Highlight if appropriate.  This works because
-		 * we only get one score per level.
-		 */
-		if (me != NULL &&
-		    sp->hs_level == level &&
-		    sp->hs_score == score &&
-		    strcmp(sp->hs_name, me) == 0) {
-			putpad(SOstr);
-			highlight = 1;
-		}
-		(void)printf("%s", buf);
-		if (highlight) {
-			putpad(SEstr);
-			highlight = 0;
-		}
-	}
-}
+/* 	struct highscore *sp; */
+/* 	int i, n, c; */
+/* 	const char *me; */
+/* 	int levelfound[NLEVELS]; */
+
+/* 	if (!gotscores) */
+/* 		getscores((FILE **)NULL); */
+/* 	(void)printf("\n\t\t    Tetris High Scores\n"); */
+
+/* 	/\* */
+/* 	 * If level == 0, the person has not played a game but just asked for */
+/* 	 * the high scores; we do not need to check for printing in highlight */
+/* 	 * mode.  If SOstr is null, we can't do highlighting anyway. */
+/* 	 *\/ */
+/* 	me = level && SOstr ? thisuser() : NULL; */
+
+/* 	/\* */
+/* 	 * Set times to 0 except for high score on each level. */
+/* 	 *\/ */
+/* 	for (i = MINLEVEL; i < NLEVELS; i++) */
+/* 		levelfound[i] = 0; */
+/* 	for (i = 0, sp = scores; i < nscores; i++, sp++) { */
+/* 		if (levelfound[sp->hs_level]) */
+/* 			sp->hs_time = 0; */
+/* 		else { */
+/* 			sp->hs_time = 1; */
+/* 			levelfound[sp->hs_level] = 1; */
+/* 		} */
+/* 	} */
+
+/* 	/\* */
+/* 	 * Page each screenful of scores. */
+/* 	 *\/ */
+/* 	for (i = 0, sp = scores; i < nscores; sp += n) { */
+/* 		n = 20; */
+/* 		if (i + n > nscores) */
+/* 			n = nscores - i; */
+/* 		printem(level, i + 1, sp, n, me); */
+/* 		if ((i += n) < nscores) { */
+/* 			(void)printf("\nHit RETURN to continue."); */
+/* 			(void)fflush(stdout); */
+/* 			while ((c = getchar()) != '\n') */
+/* 				if (c == EOF) */
+/* 					break; */
+/* 			(void)printf("\n"); */
+/* 		} */
+/* 	} */
+
+/* 	if (nscores == 0) */
+/* 		printf("\t\t\t      - none to date.\n"); */
+/* } */
+
+/* static void */
+/* printem(int level, int offset, struct highscore *hs, int n, const char *me) */
+/* { */
+/* 	struct highscore *sp; */
+/* 	int row, highlight, i; */
+/* 	char buf[100]; */
+/* #define	TITLE "Rank  Score   Name                          (points/level)" */
+/* #define	TITL2 "==========================================================" */
+
+/* 	printf("%s\n%s\n", TITLE, TITL2); */
+
+/* 	highlight = 0; */
+
+/* 	for (row = 0; row < n; row++) { */
+/* 		sp = &hs[row]; */
+/* 		(void)snprintf(buf, sizeof(buf), */
+/* 		    "%3d%c %6d  %-31s (%6d on %d)\n", */
+/* 		    row + offset, sp->hs_time ? '*' : ' ', */
+/* 		    sp->hs_score * sp->hs_level, */
+/* 		    sp->hs_name, sp->hs_score, sp->hs_level); */
+/* 		/\* Print leaders every three lines *\/ */
+/* 		if ((row + 1) % 3 == 0) { */
+/* 			for (i = 0; i < sizeof(buf); i++) */
+/* 				if (buf[i] == ' ') */
+/* 					buf[i] = '_'; */
+/* 		} */
+/* 		/\* */
+/* 		 * Highlight if appropriate.  This works because */
+/* 		 * we only get one score per level. */
+/* 		 *\/ */
+/* 		if (me != NULL && */
+/* 		    sp->hs_level == level && */
+/* 		    sp->hs_score == score && */
+/* 		    strcmp(sp->hs_name, me) == 0) { */
+/* 			putpad(SOstr); */
+/* 			highlight = 1; */
+/* 		} */
+/* 		(void)printf("%s", buf); */
+/* 		if (highlight) { */
+/* 			putpad(SEstr); */
+/* 			highlight = 0; */
+/* 		} */
+/* 	} */
+/* } */
Index: tetris/scores.h
===================================================================
--- tetris/scores.h	(revision b27a97bb30fc0f831ab37f52c45321ec3d904ca4)
+++ tetris/scores.h	(revision c0e674a238ff74e58b8536aa4cc81699ae586e95)
@@ -39,4 +39,6 @@
  * Tetris scores.
  */
+#include <sys/time.h>
+#define MAXLOGNAME 10
 struct highscore {
 	char	hs_name[MAXLOGNAME];	/* login name */
@@ -50,4 +52,4 @@
 #define	EXPIRATION	(5L * 365 * 24 * 60 * 60)
 
-void	savescore(int);
-void	showscores(int);
+void savescore(int);
+void showscores(int);
