home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / x / xhearts.zip / DEFS.H < prev    next >
C/C++ Source or Header  |  1992-01-07  |  880b  |  40 lines

  1. #include <sys/types.h>
  2. #include <sys/socket.h>
  3. #include <sys/file.h>
  4. #include <netinet/in.h>
  5. #include <netdb.h>
  6.  
  7. #ifndef NULL
  8. #define NULL 0
  9. #endif
  10.  
  11. #define INSTRUCT "hearts.instr"
  12. #define HEARTSD "heartsd"
  13. #define HEARTS_DIST "hearts_dist"
  14.  
  15. #define    SLEN    40        /* short string */
  16. #define    PROTO    "tcp"        /* protocol */
  17. #define    SERVICE    "hearts"    /* official service name */
  18.  
  19. #ifdef    FD_SETSIZE
  20.  
  21. #define WIDTH FD_SETSIZE
  22. typedef    fd_set    fd_type;
  23.  
  24. #define fd_init(sock, fds) FD_ZERO(fds); FD_SET(sock, fds)
  25. #define fd_set(sock, fds)  FD_SET(sock, fds)
  26. #define fd_zero(fds) FD_ZERO(fds)
  27. #define fd_isset(sock, fds)  (sock >=0 && FD_ISSET(sock, &fds))
  28.  
  29. #else
  30.  
  31. #define WIDTH 32
  32. typedef    int    fd_type;
  33.  
  34. #define fd_init(sock, fds) *fds = 1 << sock
  35. #define fd_set(sock, fds)  *fds |= 1 << sock
  36. #define fd_zero(sock, fds) *fds = 0
  37. #define fd_isset(sock, fds)  (sock >=0 && fds & (1 << sock))
  38.  
  39. #endif
  40.