1 // Various things you need when porting BSD and GNU utilities to
2 // Win32.
3 
4 #ifndef VARIOUS_H
5 #define VARIOUS_H
6 
7 /* types.h */
8 typedef unsigned char u_char;
9 typedef unsigned int u_int;
10 typedef float f4byte_t;
11 typedef double f8byte_t;
12 //typedef __int16 s2byte_t;
13 //typedef __int32 s4byte_t;
14 //typedef __int64 s8byte_t;
15 //typedef unsigned __int16 u2byte_t;
16 //typedef unsigned __int32 u4byte_t;
17 //typedef unsigned __int64 u8byte_t;
18 //typedef __int32 quad_t;
19 //typedef unsigned __int32 u_quad_t;
20 //typedef unsigned __int16 u_int16_t;
21 //typedef unsigned __int32 u_int32_t;
22 
23 typedef long uid_t;  // SunOS 5.5
24 
25 #define __P(x) x
26 //#define __STDC__ 1
27 
28 /* utmp.h */
29 #define UT_LINESIZE 8
30 #define UT_HOSTSIZE 16
31 
32 /* stat.h */
33 //#define  S_ISREG(mode)   (((mode)&0xF000) == 0x8000)
34 //#define  S_ISDIR(mode)   (((mode)&0xF000) == 0x4000)
35 
36 #undef MIN //take care of windows default
37 #undef MAX //take care of windows default
38 #define MIN(a, b) ((a) <= (b) ? (a) : (b))
39 #define MAX(a, b) ((a) > (b) ? (a) : (b))
40 
41 #define bcopy(s1, s2, n)  memmove(s2, s1, n)
42 #define bcmp(s1, s2, n)  (memcmp(s1, s2, n) != 0)
43 #define bzero(s, n)  memset(s, 0, n)
44 
45 #define index(s, c)  strchr(s, c)
46 #define rindex(s, c)  strrchr(s, c)
47 
48 //#ifndef _WINSOCKAPI_
49 //struct timeval {
50 //        long    tv_sec;         /* seconds */
51 //        long    tv_usec;        /* and microseconds */
52 //};
53 //#endif
54 
55 #endif
56