Sat, 14 Jun 2003 15:25:03 +0000
[gaim-migrate @ 6299]
assorted compile cleanups and fixes I came across
| 3776 | 1 | /* |
| 2 | * libc_interface.h | |
| 3 | */ | |
| 4 | ||
| 5 | #ifndef _LIBC_INTERFACE_H_ | |
| 6 | #define _LIBC_INTERFACE_H_ | |
| 7 | #include <winsock.h> | |
|
4714
08b54a8f301f
[gaim-migrate @ 5025]
Herman Bloggs <herman@bluedigits.com>
parents:
4373
diff
changeset
|
8 | #include <io.h> |
| 3776 | 9 | #include <errno.h> |
| 10 | #include "libc_internal.h" | |
| 11 | ||
| 12 | /* sys/socket.h */ | |
| 13 | extern int wgaim_socket(int namespace, int style, int protocol); | |
| 14 | #define socket( namespace, style, protocol ) \ | |
| 15 | wgaim_socket( ## namespace ##, ## style ##, ## protocol ## ) | |
| 16 | ||
| 17 | extern int wgaim_connect(int socket, struct sockaddr *addr, u_long length); | |
| 18 | #define connect( socket, addr, length ) \ | |
| 19 | wgaim_connect( ## socket ##, ## addr ##, ## length ## ) | |
| 20 | ||
| 21 | extern int wgaim_getsockopt(int socket, int level, int optname, void *optval, unsigned int *optlenptr); | |
| 22 | #define getsockopt( args... ) \ | |
| 23 | wgaim_getsockopt( ## args ) | |
| 24 | ||
| 25 | /* sys/ioctl.h */ | |
| 26 | extern int wgaim_ioctl(int fd, int command, void* opt); | |
| 27 | #define ioctl( fd, command, val ) \ | |
| 28 | wgaim_ioctl( ## fd ##, ## command ##, ## val ## ) | |
| 29 | ||
| 30 | /* fcntl.h */ | |
| 31 | extern int wgaim_fcntl(int socket, int command, int val); | |
| 32 | #define fcntl( fd, command, val ) \ | |
| 33 | wgaim_fcntl( ## fd ##, ## command ##, ## val ## ) | |
| 34 | ||
| 35 | #define open( args... ) _open( ## args ) | |
| 36 | ||
| 37 | /* arpa/inet.h */ | |
| 38 | extern int wgaim_inet_aton(const char *name, struct in_addr *addr); | |
| 39 | #define inet_aton( name, addr ) \ | |
| 40 | wgaim_inet_aton( ## name ##, ## addr ## ) | |
| 41 | ||
| 42 | /* netdb.h */ | |
| 43 | extern struct hostent* wgaim_gethostbyname(const char *name); | |
| 44 | #define gethostbyname( name ) \ | |
| 45 | wgaim_gethostbyname( ## name ## ) | |
| 46 | ||
|
5084
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4905
diff
changeset
|
47 | /* netinet/in.h */ |
|
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4905
diff
changeset
|
48 | #define ntohl( netlong ) \ |
|
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4905
diff
changeset
|
49 | (unsigned int)ntohl( ## netlong ## ) |
|
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4905
diff
changeset
|
50 | |
| 3776 | 51 | /* string.h */ |
| 52 | extern char* wgaim_strerror( int errornum ); | |
| 53 | #define hstrerror( herror ) \ | |
| 54 | wgaim_strerror( errno ) | |
| 55 | #define strerror( errornum ) \ | |
| 56 | wgaim_strerror( ## errornum ## ) | |
| 57 | ||
|
4193
0f6072a0ffa4
[gaim-migrate @ 4424]
Herman Bloggs <herman@bluedigits.com>
parents:
3776
diff
changeset
|
58 | extern char* wgaim_strsep(char **stringp, const char *delim); |
|
0f6072a0ffa4
[gaim-migrate @ 4424]
Herman Bloggs <herman@bluedigits.com>
parents:
3776
diff
changeset
|
59 | #define strsep( stringp, delim ) \ |
|
0f6072a0ffa4
[gaim-migrate @ 4424]
Herman Bloggs <herman@bluedigits.com>
parents:
3776
diff
changeset
|
60 | wgaim_strsep( ## stringp ##, ## delim ## ) |
|
0f6072a0ffa4
[gaim-migrate @ 4424]
Herman Bloggs <herman@bluedigits.com>
parents:
3776
diff
changeset
|
61 | |
| 3776 | 62 | #define bzero( dest, size ) memset( ## dest ##, 0, ## size ## ) |
| 63 | ||
| 64 | /* unistd.h */ | |
| 65 | extern int wgaim_read(int fd, void *buf, unsigned int size); | |
| 66 | #define read( fd, buf, buflen ) \ | |
| 67 | wgaim_read( ## fd ##, ## buf ##, ## buflen ## ) | |
| 68 | ||
| 69 | extern int wgaim_write(int fd, const void *buf, unsigned int size); | |
| 70 | #define write( socket, buf, buflen ) \ | |
| 71 | wgaim_write( ## socket ##, ## buf ##, ## buflen ## ) | |
| 72 | ||
| 73 | extern int wgaim_close(int fd); | |
| 74 | #define close( fd ) \ | |
| 75 | wgaim_close( ## fd ## ) | |
| 76 | ||
| 77 | #define sleep(x) Sleep((x)*1000) | |
| 78 | ||
| 79 | /* sys/time.h */ | |
| 80 | extern int wgaim_gettimeofday(struct timeval *p, struct timezone *z); | |
| 81 | #define gettimeofday( timeval, timezone ) \ | |
| 82 | wgaim_gettimeofday( ## timeval ##, ## timezone ## ) | |
| 83 | ||
| 84 | /* stdio.h */ | |
| 85 | #define snprintf _snprintf | |
| 86 | #define vsnprintf _vsnprintf | |
| 87 | ||
|
4905
1464e05926f0
[gaim-migrate @ 5239]
Herman Bloggs <herman@bluedigits.com>
parents:
4714
diff
changeset
|
88 | extern int wgaim_rename(const char *oldname, const char *newname); |
|
1464e05926f0
[gaim-migrate @ 5239]
Herman Bloggs <herman@bluedigits.com>
parents:
4714
diff
changeset
|
89 | #define rename( oldname, newname ) \ |
|
1464e05926f0
[gaim-migrate @ 5239]
Herman Bloggs <herman@bluedigits.com>
parents:
4714
diff
changeset
|
90 | wgaim_rename( ## oldname ##, ## newname ## ) |
|
1464e05926f0
[gaim-migrate @ 5239]
Herman Bloggs <herman@bluedigits.com>
parents:
4714
diff
changeset
|
91 | |
| 3776 | 92 | /* sys/stat.h */ |
| 93 | #define mkdir(a,b) _mkdir((a)) | |
|
4373
fb2ae2f5edd3
[gaim-migrate @ 4639]
Herman Bloggs <herman@bluedigits.com>
parents:
4193
diff
changeset
|
94 | #define fchmod(a,b) |
| 3776 | 95 | |
|
5113
8e545faf3d80
[gaim-migrate @ 5476]
Herman Bloggs <herman@bluedigits.com>
parents:
5084
diff
changeset
|
96 | /* time.h */ |
|
8e545faf3d80
[gaim-migrate @ 5476]
Herman Bloggs <herman@bluedigits.com>
parents:
5084
diff
changeset
|
97 | extern struct tm *wgaim_localtime_r(const time_t *time, struct tm *resultp); |
|
8e545faf3d80
[gaim-migrate @ 5476]
Herman Bloggs <herman@bluedigits.com>
parents:
5084
diff
changeset
|
98 | #define localtime_r( time, resultp ) \ |
|
8e545faf3d80
[gaim-migrate @ 5476]
Herman Bloggs <herman@bluedigits.com>
parents:
5084
diff
changeset
|
99 | wgaim_localtime_r( ## time ##, ## resultp ## ) |
|
8e545faf3d80
[gaim-migrate @ 5476]
Herman Bloggs <herman@bluedigits.com>
parents:
5084
diff
changeset
|
100 | |
| 3776 | 101 | #endif /* _LIBC_INTERFACE_H_ */ |