| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#ifndef __W32_H__ |
| 17 |
#define __W32_H__ |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#include <direct.h> |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#ifndef _POSIX_SOURCE |
| 26 |
typedef unsigned char u_char; |
| 27 |
typedef unsigned short u_short; |
| 28 |
typedef unsigned int u_int; |
| 29 |
typedef unsigned long u_long; |
| 30 |
typedef unsigned short ushort; |
| 31 |
typedef unsigned int uint; |
| 32 |
#endif |
| 33 |
|
| 34 |
typedef unsigned char u_int8_t; |
| 35 |
typedef unsigned short u_int16_t; |
| 36 |
typedef unsigned long u_int32_t; |
| 37 |
typedef unsigned __int64 u_int64_t; |
| 38 |
typedef signed char int8_t; |
| 39 |
typedef signed short int16_t; |
| 40 |
typedef signed long int32_t; |
| 41 |
typedef signed __int64 int64_t; |
| 42 |
|
| 43 |
typedef u_int32_t pid_t; |
| 44 |
|
| 45 |
|
| 46 |
#ifndef __BORLANDC__ |
| 47 |
typedef u_int32_t uid_t; |
| 48 |
typedef u_int32_t gid_t; |
| 49 |
#endif |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
#ifndef inline |
| 54 |
#define inline __inline |
| 55 |
#endif |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
#include <sys/stat.h> |
| 60 |
|
| 61 |
#ifndef S_IFLNK |
| 62 |
#define S_IFLNK 0120000 |
| 63 |
#endif |
| 64 |
#ifndef S_ISUID |
| 65 |
#define S_ISUID 0004000 |
| 66 |
#endif |
| 67 |
#ifndef S_ISGID |
| 68 |
#define S_ISGID 0002000 |
| 69 |
#endif |
| 70 |
#ifndef S_IRWXU |
| 71 |
#define S_IRWXU 0000700 |
| 72 |
#endif |
| 73 |
#ifndef S_IRUSR |
| 74 |
#define S_IRUSR 0000400 |
| 75 |
#endif |
| 76 |
#ifndef S_IWUSR |
| 77 |
#define S_IWUSR 0000200 |
| 78 |
#endif |
| 79 |
#ifndef S_IXUSR |
| 80 |
#define S_IXUSR 0000100 |
| 81 |
#endif |
| 82 |
#ifndef S_IRWXG |
| 83 |
#define S_IRWXG 0000070 |
| 84 |
#endif |
| 85 |
#ifndef S_IRGRP |
| 86 |
#define S_IRGRP 0000040 |
| 87 |
#endif |
| 88 |
#ifndef S_IWGRP |
| 89 |
#define S_IWGRP 0000020 |
| 90 |
#endif |
| 91 |
#ifndef S_IXGRP |
| 92 |
#define S_IXGRP 0000010 |
| 93 |
#endif |
| 94 |
#ifndef S_IRWXO |
| 95 |
#define S_IRWXO 0000007 |
| 96 |
#endif |
| 97 |
#ifndef S_IROTH |
| 98 |
#define S_IROTH 0000004 |
| 99 |
#endif |
| 100 |
#ifndef S_IWOTH |
| 101 |
#define S_IWOTH 0000002 |
| 102 |
#endif |
| 103 |
#ifndef S_IXOTH |
| 104 |
#define S_IXOTH 0000001 |
| 105 |
#endif |
| 106 |
|
| 107 |
#ifndef S_ISDIR |
| 108 |
#define S_ISDIR(mode) (((mode)&(_S_IFMT))==(_S_IFDIR)) |
| 109 |
#endif |
| 110 |
#ifndef S_ISREG |
| 111 |
#define S_ISREG(mode) (((mode)&(_S_IFMT))==(_S_IFREG)) |
| 112 |
#endif |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
#define strcasecmp stricmp |
| 118 |
#define strncasecmp strnicmp |
| 119 |
#define snprintf _snprintf |
| 120 |
#if _MSC_VER < 1500 |
| 121 |
#define vsnprintf _vsnprintf |
| 122 |
#endif |
| 123 |
#define lstat stat |
| 124 |
|
| 125 |
size_t strlcpy(char *, const char*, size_t); |
| 126 |
size_t strlcat(char *, const char*, size_t); |
| 127 |
|
| 128 |
char *realpath(const char *, char*); |
| 129 |
|
| 130 |
#ifdef INET6 |
| 131 |
#include <winsock2.h> |
| 132 |
#else |
| 133 |
#include <winsock.h> |
| 134 |
#endif |
| 135 |
|
| 136 |
int wsa_socketpair(SOCKET *); |
| 137 |
void wsa_create_terminal(SOCKET); |
| 138 |
char *wsa_strerror(int); |
| 139 |
void wsa_perror(char *); |
| 140 |
#define wsa_lasterror() WSAGetLastError() |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
#define _W32_USER_ID 0 |
| 145 |
#define _W32_GROUP_ID 0 |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
#endif |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|