home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / header45.zip / stack16 / utils.h < prev    next >
Text File  |  1999-05-11  |  2KB  |  59 lines

  1. #ifndef __UTILS_32H
  2. #define __UTILS_32H
  3.  
  4. #ifdef __BORLANDC__         /* DRC01 - changed _System to _syscall */
  5. #ifndef _System             /* DRC01 */
  6. #define _System _syscall    /* DRC01 */
  7. #endif                      /* DRC01 */
  8. #endif                      /* DRC01 */
  9.  
  10. #ifdef __HIGHC__            /* DRC04 - changed _System */
  11. #define _System             /* DRC04 */
  12. #endif                      /* DRC04 */
  13.  
  14.  
  15. unsigned long _System lswap(unsigned long);
  16. unsigned short _System bswap(unsigned short);
  17. int _System rexec(char **, int, char *, char *, char *, int *);
  18. /* int _System getpid(void); */
  19.  
  20. /* Definition for bswap */
  21. #define htonl(x)   (lswap(x))
  22. #define ntohl(x)   (lswap(x))
  23. #define htons(x)   (bswap(x))
  24. #define ntohs(x)   (bswap(x))
  25.  
  26. #ifndef X11
  27. #define bzero(x,y) memset((x),'\0',(y))
  28. #define bcopy(x,y,z) memcpy((y),(x),(z))
  29. #define bcmp(x,y,z)  memcmp((y),(x),(z))
  30. #endif /* X11 */
  31. #define ovbcopy(x,y,z) bcopy((x),(y),(z))
  32. #define copyout(x,y,z) memcpy((y),(x),(z))
  33. #define strcasecmp(x,y) strcmpi((x),(y))
  34. #define strncasecmp(x,y,z) strnicmp(x,y,z)
  35. #define sleep(x) DosSleep(((long)(x))*1000L)
  36.  
  37. #ifndef MIN
  38. #define MIN(a,b) (((a)<(b))?(a):(b))
  39. #define imin(x,y) MIN((x),(y))
  40. #define MAX(a,b) (((a)>(b))?(a):(b))
  41. #endif
  42. #ifndef min
  43. #define min(a,b) (((a)<(b))?(a):(b))
  44. #endif
  45.  
  46. #define timercmp(t1,t2,op) (((t1)->tv_sec op (t2)->tv_sec) || \
  47.                            (((t1)->tv_sec == (t2)->tv_sec) \
  48.                            && ((t1)->tv_usec op (t2)->tv_usec)))
  49.  
  50. #ifndef __BORLANDC__         /* DRC03 - if using BORLAND then use */
  51.                              /* DRC03 - its random function */
  52. #define random() ((unsigned long)rand())
  53. #endif
  54.  
  55. #define srandom(x) srand(x)
  56.  
  57. #endif /* __UTILS_32H */
  58.  
  59.