diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-11-03 22:14:55 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-11-03 22:14:55 +0000 |
commit | d1711d2af23d033aa68b258778c354aaaec1c75e (patch) | |
tree | 6a81f08981c0c1bc216e1b0c68d2df2c7c555d45 /games/robots | |
parent | 1e8e39c1f489fa3e8e27b46744c1466b1dbba5d1 (diff) |
select() to poll() conversions
ok tedu (... other games maintainer absent)
Diffstat (limited to 'games/robots')
-rw-r--r-- | games/robots/extern.c | 3 | ||||
-rw-r--r-- | games/robots/main.c | 3 | ||||
-rw-r--r-- | games/robots/move.c | 10 | ||||
-rw-r--r-- | games/robots/robots.h | 4 |
4 files changed, 11 insertions, 9 deletions
diff --git a/games/robots/extern.c b/games/robots/extern.c index d0cecf34754..4ae1ea916d9 100644 --- a/games/robots/extern.c +++ b/games/robots/extern.c @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.c,v 1.5 2009/10/27 23:59:26 deraadt Exp $ */ +/* $OpenBSD: extern.c,v 1.6 2014/11/03 22:14:54 deraadt Exp $ */ /* $NetBSD: extern.c,v 1.3 1995/04/22 10:08:49 cgd Exp $ */ /* @@ -62,7 +62,6 @@ int Score; /* Current score */ int Start_level = 1; /* Level on which to start */ int Wait_bonus; /* bonus for waiting */ -fd_set rset; /* Needed if Real_time */ struct timeval tv; /* how long to wait; could be an option */ COORD Max; /* Max area robots take up */ diff --git a/games/robots/main.c b/games/robots/main.c index fc2c2cede84..3f7cf413cdd 100644 --- a/games/robots/main.c +++ b/games/robots/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.18 2013/08/29 20:22:19 naddy Exp $ */ +/* $OpenBSD: main.c,v 1.19 2014/11/03 22:14:54 deraadt Exp $ */ /* $NetBSD: main.c,v 1.5 1995/04/22 10:08:54 cgd Exp $ */ /* @@ -71,7 +71,6 @@ main(int ac, char *av[]) /* Could be a command-line option */ tv.tv_sec = 3; tv.tv_usec = 0; - FD_ZERO(&rset); break; case 'a': Start_level = 4; diff --git a/games/robots/move.c b/games/robots/move.c index c187d268ac4..558fbfb3cf2 100644 --- a/games/robots/move.c +++ b/games/robots/move.c @@ -1,4 +1,4 @@ -/* $OpenBSD: move.c,v 1.9 2009/10/27 23:59:26 deraadt Exp $ */ +/* $OpenBSD: move.c,v 1.10 2014/11/03 22:14:54 deraadt Exp $ */ /* $NetBSD: move.c,v 1.4 1995/04/22 10:08:58 cgd Exp $ */ /* @@ -90,8 +90,12 @@ get_move(void) else { over: if (Real_time) { - FD_SET(STDIN_FILENO, &rset); - retval = select(STDIN_FILENO + 1, &rset, NULL, NULL, &t); + struct pollfd pfd[1]; + + pfd[0].fd = STDIN_FILENO; + pfd[0].events = POLLIN; + retval = poll(pfd, 1, + t.tv_sec * 1000 + t.tv_usec / 1000); if (retval > 0) c = getchar(); else /* Don't move if timed out or error */ diff --git a/games/robots/robots.h b/games/robots/robots.h index 0a1e2aae19e..52aa374df92 100644 --- a/games/robots/robots.h +++ b/games/robots/robots.h @@ -1,4 +1,4 @@ -/* $OpenBSD: robots.h,v 1.6 2003/06/03 03:01:41 millert Exp $ */ +/* $OpenBSD: robots.h,v 1.7 2014/11/03 22:14:54 deraadt Exp $ */ /* $NetBSD: robots.h,v 1.5 1995/04/24 12:24:54 cgd Exp $ */ /* @@ -46,6 +46,7 @@ #include <stdlib.h> #include <termios.h> #include <unistd.h> +#include <poll.h> /* * miscellaneous constants @@ -106,7 +107,6 @@ extern char Cnt_move, Field[Y_FIELDSIZE][X_FIELDSIZE], *Next_move, extern int Count, Level, Num_robots, Num_scores, Score, Start_level, Wait_bonus; -extern fd_set rset; extern struct timeval tv; extern COORD Max, Min, My_pos, Robots[]; |