home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / UNIX / ARCHIE / CLIENTS / XARCHIE3.TAR / xarchie-2.0.1 / selectdefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-22  |  1.2 KB  |  47 lines

  1. /*
  2.  * selectdefs.h : FD_SET and relatives
  3.  *
  4.  * George Ferguson, ferguson@cs.rochester.edu, 23 Apr 1993.
  5.  *
  6.  * I don't really expect this to work if none of the include cases
  7.  * is used. I mean, where's the definition of the fd_set structure,
  8.  * anyway? However, perhaps it's a start. Better would be to add a case
  9.  * to the confgure script to find the things no matter where they are.
  10.  */
  11.  
  12. #include "config.h"
  13.  
  14. #ifdef FD_SET_IN_SYS_TYPES_H            /* normal */
  15. # include <sys/types.h>
  16. #else
  17. #ifdef FD_SET_IN_SYS_SELECT_H
  18. # include <sys/select.h>            /* _AIX */
  19. #else
  20. #ifdef FD_SET_IN_SYS_INET_H
  21. # include <sys/inet.h>                /* u3b2 */
  22. #else
  23. # ifndef NBBY
  24. #  define NBBY        8                /* bits per byte */
  25. # endif
  26. # ifndef NFDBITS
  27. #  define NFDBITS    (sizeof (fd_mask) * NBBY)       /* bits per mask */
  28. # endif
  29. # ifndef FD_SETSIZE
  30. #  define FD_SETSIZE    32
  31. # endif
  32. # ifndef FD_SET
  33. #  define FD_SET(n,p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  34. # endif
  35. # ifndef FD_CLR
  36. #  define FD_CLR(n,p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  37. # endif
  38. # ifndef FD_ISSET
  39. #  define FD_ISSET(n,p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  40. # endif
  41. # ifndef FD_ZERO
  42. #  define FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  43. # endif
  44. #endif
  45. #endif
  46. #endif
  47.