File: select.c

package info (click to toggle)
bsdgames 2.1-3hamm1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 8,368 kB
  • ctags: 4,860
  • sloc: ansic: 59,005; makefile: 1,058; sh: 511; yacc: 327; lex: 79; sed: 13; csh: 5
file content (23 lines) | stat: -rw-r--r-- 649 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* select.c - bsd-games emulation of BSD select for games that need it */

/* This uses __select, which works with libc5 and libc6.  This is a
 * substitute for the version in libbsd from libc5, and is essentially
 * equivalent.  */

#include <sys/time.h>

int
select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
       struct timeval *timeout)
{
  struct timeval timeout_copy;
  struct timeval *timeout_ptr;
  if (timeout) {
    /* Copy to a temporary */
    timeout_copy = *timeout;
    timeout_ptr = &timeout_copy;
  } else {
    timeout_ptr = timeout;
  }
  return __select(nfds, readfds, writefds, exceptfds, timeout_ptr);
}