| 28 #include "libc_internal.h" |
28 #include "libc_internal.h" |
| 29 |
29 |
| 30 /* sys/socket.h */ |
30 /* sys/socket.h */ |
| 31 extern int wgaim_socket(int namespace, int style, int protocol); |
31 extern int wgaim_socket(int namespace, int style, int protocol); |
| 32 #define socket( namespace, style, protocol ) \ |
32 #define socket( namespace, style, protocol ) \ |
| 33 wgaim_socket( ## namespace ##, ## style ##, ## protocol ## ) |
33 wgaim_socket( namespace, style, protocol ) |
| 34 |
34 |
| 35 extern int wgaim_connect(int socket, struct sockaddr *addr, u_long length); |
35 extern int wgaim_connect(int socket, struct sockaddr *addr, u_long length); |
| 36 #define connect( socket, addr, length ) \ |
36 #define connect( socket, addr, length ) \ |
| 37 wgaim_connect( ## socket ##, ## addr ##, ## length ## ) |
37 wgaim_connect( socket, addr, length ) |
| 38 |
38 |
| 39 extern int wgaim_getsockopt(int socket, int level, int optname, void *optval, unsigned int *optlenptr); |
39 extern int wgaim_getsockopt(int socket, int level, int optname, void *optval, unsigned int *optlenptr); |
| 40 #define getsockopt( args... ) \ |
40 #define getsockopt( args... ) \ |
| 41 wgaim_getsockopt( ## args ) |
41 wgaim_getsockopt( args ) |
| 42 |
42 |
| 43 /* sys/ioctl.h */ |
43 /* sys/ioctl.h */ |
| 44 extern int wgaim_ioctl(int fd, int command, void* opt); |
44 extern int wgaim_ioctl(int fd, int command, void* opt); |
| 45 #define ioctl( fd, command, val ) \ |
45 #define ioctl( fd, command, val ) \ |
| 46 wgaim_ioctl( ## fd ##, ## command ##, ## val ## ) |
46 wgaim_ioctl( fd, command, val ) |
| 47 |
47 |
| 48 /* fcntl.h */ |
48 /* fcntl.h */ |
| 49 extern int wgaim_fcntl(int socket, int command, int val); |
49 extern int wgaim_fcntl(int socket, int command, int val); |
| 50 #define fcntl( fd, command, val ) \ |
50 #define fcntl( fd, command, val ) \ |
| 51 wgaim_fcntl( ## fd ##, ## command ##, ## val ## ) |
51 wgaim_fcntl( fd, command, val ) |
| 52 |
52 |
| 53 #define open( args... ) _open( ## args ) |
53 #define open( args... ) _open( ## args ) |
| 54 |
54 |
| 55 /* arpa/inet.h */ |
55 /* arpa/inet.h */ |
| 56 extern int wgaim_inet_aton(const char *name, struct in_addr *addr); |
56 extern int wgaim_inet_aton(const char *name, struct in_addr *addr); |
| 57 #define inet_aton( name, addr ) \ |
57 #define inet_aton( name, addr ) \ |
| 58 wgaim_inet_aton( ## name ##, ## addr ## ) |
58 wgaim_inet_aton( name, addr ) |
| 59 |
59 |
| 60 /* netdb.h */ |
60 /* netdb.h */ |
| 61 extern struct hostent* wgaim_gethostbyname(const char *name); |
61 extern struct hostent* wgaim_gethostbyname(const char *name); |
| 62 #define gethostbyname( name ) \ |
62 #define gethostbyname( name ) \ |
| 63 wgaim_gethostbyname( ## name ## ) |
63 wgaim_gethostbyname( name ) |
| 64 |
64 |
| 65 /* netinet/in.h */ |
65 /* netinet/in.h */ |
| 66 #define ntohl( netlong ) \ |
66 #define ntohl( netlong ) \ |
| 67 (unsigned int)ntohl( ## netlong ## ) |
67 (unsigned int)ntohl( netlong ) |
| 68 |
68 |
| 69 /* string.h */ |
69 /* string.h */ |
| 70 extern char* wgaim_strerror( int errornum ); |
70 extern char* wgaim_strerror( int errornum ); |
| 71 #define hstrerror( herror ) \ |
71 #define hstrerror( herror ) \ |
| 72 wgaim_strerror( errno ) |
72 wgaim_strerror( errno ) |
| 73 #define strerror( errornum ) \ |
73 #define strerror( errornum ) \ |
| 74 wgaim_strerror( ## errornum ## ) |
74 wgaim_strerror( errornum ) |
| 75 |
75 |
| 76 extern char* wgaim_strsep(char **stringp, const char *delim); |
76 extern char* wgaim_strsep(char **stringp, const char *delim); |
| 77 #define strsep( stringp, delim ) \ |
77 #define strsep( stringp, delim ) \ |
| 78 wgaim_strsep( ## stringp ##, ## delim ## ) |
78 wgaim_strsep( stringp, delim ) |
| 79 |
79 |
| 80 #define bzero( dest, size ) memset( ## dest ##, 0, ## size ## ) |
80 #define bzero( dest, size ) memset( dest, 0, size ) |
| 81 |
81 |
| 82 /* unistd.h */ |
82 /* unistd.h */ |
| 83 extern int wgaim_read(int fd, void *buf, unsigned int size); |
83 extern int wgaim_read(int fd, void *buf, unsigned int size); |
| 84 #define read( fd, buf, buflen ) \ |
84 #define read( fd, buf, buflen ) \ |
| 85 wgaim_read( ## fd ##, ## buf ##, ## buflen ## ) |
85 wgaim_read( fd, buf, buflen ) |
| 86 |
86 |
| 87 extern int wgaim_write(int fd, const void *buf, unsigned int size); |
87 extern int wgaim_write(int fd, const void *buf, unsigned int size); |
| 88 #define write( socket, buf, buflen ) \ |
88 #define write( socket, buf, buflen ) \ |
| 89 wgaim_write( ## socket ##, ## buf ##, ## buflen ## ) |
89 wgaim_write( socket, buf, buflen ) |
| 90 |
90 |
| 91 extern int wgaim_close(int fd); |
91 extern int wgaim_close(int fd); |
| 92 #define close( fd ) \ |
92 #define close( fd ) \ |
| 93 wgaim_close( ## fd ## ) |
93 wgaim_close( fd ) |
| 94 |
94 |
| 95 #define sleep(x) Sleep((x)*1000) |
95 #define sleep(x) Sleep((x)*1000) |
| 96 |
96 |
| 97 /* sys/time.h */ |
97 /* sys/time.h */ |
| 98 extern int wgaim_gettimeofday(struct timeval *p, struct timezone *z); |
98 extern int wgaim_gettimeofday(struct timeval *p, struct timezone *z); |
| 99 #define gettimeofday( timeval, timezone ) \ |
99 #define gettimeofday( timeval, timezone ) \ |
| 100 wgaim_gettimeofday( ## timeval ##, ## timezone ## ) |
100 wgaim_gettimeofday( timeval, timezone ) |
| 101 |
101 |
| 102 /* stdio.h */ |
102 /* stdio.h */ |
| 103 #define snprintf _snprintf |
103 #define snprintf _snprintf |
| 104 #define vsnprintf _vsnprintf |
104 #define vsnprintf _vsnprintf |
| 105 |
105 |
| 106 extern int wgaim_rename(const char *oldname, const char *newname); |
106 extern int wgaim_rename(const char *oldname, const char *newname); |
| 107 #define rename( oldname, newname ) \ |
107 #define rename( oldname, newname ) \ |
| 108 wgaim_rename( ## oldname ##, ## newname ## ) |
108 wgaim_rename( oldname, newname ) |
| 109 |
109 |
| 110 /* sys/stat.h */ |
110 /* sys/stat.h */ |
| 111 #define mkdir(a,b) _mkdir((a)) |
111 #define mkdir(a,b) _mkdir((a)) |
| 112 #define fchmod(a,b) |
112 #define fchmod(a,b) |
| 113 |
113 |
| 114 /* time.h */ |
114 /* time.h */ |
| 115 extern struct tm *wgaim_localtime_r(const time_t *time, struct tm *resultp); |
115 extern struct tm *wgaim_localtime_r(const time_t *time, struct tm *resultp); |
| 116 #define localtime_r( time, resultp ) \ |
116 #define localtime_r( time, resultp ) \ |
| 117 wgaim_localtime_r( ## time ##, ## resultp ## ) |
117 wgaim_localtime_r( time, resultp ) |
| 118 |
118 |
| 119 #endif /* _LIBC_INTERFACE_H_ */ |
119 #endif /* _LIBC_INTERFACE_H_ */ |