annotate src/win32/libc_interface.h @ 7447:0e7a835e2433

[gaim-migrate @ 8058] I fixed some memleaks. Trying to view someone's log twice causes bad things? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 06 Nov 2003 08:32:17 +0000
parents 59ffe137176d
children 5e7ffea3f76a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
1 /*
5913
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
2 * gaim
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
3 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
4 * File: libc_interface.h
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
5 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
6 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
7 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
8 * This program is free software; you can redistribute it and/or modify
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
9 * it under the terms of the GNU General Public License as published by
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
11 * (at your option) any later version.
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
12 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
13 * This program is distributed in the hope that it will be useful,
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
16 * GNU General Public License for more details.
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
17 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
18 * You should have received a copy of the GNU General Public License
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
19 * along with this program; if not, write to the Free Software
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
21 *
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
22 */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
23 #ifndef _LIBC_INTERFACE_H_
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
24 #define _LIBC_INTERFACE_H_
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
25 #include <winsock.h>
4714
51ce3eb7e0bf [gaim-migrate @ 5025]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4373
diff changeset
26 #include <io.h>
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
27 #include <errno.h>
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
28 #include "libc_internal.h"
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
29
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
30 /* sys/socket.h */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
31 extern int wgaim_socket(int namespace, int style, int protocol);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
32 #define socket( namespace, style, protocol ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
33 wgaim_socket( namespace, style, protocol )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
34
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
35 extern int wgaim_connect(int socket, struct sockaddr *addr, u_long length);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
36 #define connect( socket, addr, length ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
37 wgaim_connect( socket, addr, length )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
38
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
39 extern int wgaim_getsockopt(int socket, int level, int optname, void *optval, unsigned int *optlenptr);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
40 #define getsockopt( args... ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
41 wgaim_getsockopt( args )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
42
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
43 /* sys/ioctl.h */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
44 extern int wgaim_ioctl(int fd, int command, void* opt);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
45 #define ioctl( fd, command, val ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
46 wgaim_ioctl( fd, command, val )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
47
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
48 /* fcntl.h */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
49 extern int wgaim_fcntl(int socket, int command, int val);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
50 #define fcntl( fd, command, val ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
51 wgaim_fcntl( fd, command, val )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
52
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
53 #define open( args... ) _open( ## args )
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
54
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
55 /* arpa/inet.h */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
56 extern int wgaim_inet_aton(const char *name, struct in_addr *addr);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
57 #define inet_aton( name, addr ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
58 wgaim_inet_aton( name, addr )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
59
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
60 /* netdb.h */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
61 extern struct hostent* wgaim_gethostbyname(const char *name);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
62 #define gethostbyname( name ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
63 wgaim_gethostbyname( name )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
64
5084
a96653493416 [gaim-migrate @ 5439]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4905
diff changeset
65 /* netinet/in.h */
a96653493416 [gaim-migrate @ 5439]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4905
diff changeset
66 #define ntohl( netlong ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
67 (unsigned int)ntohl( netlong )
5084
a96653493416 [gaim-migrate @ 5439]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4905
diff changeset
68
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
69 /* string.h */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
70 extern char* wgaim_strerror( int errornum );
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
71 #define hstrerror( herror ) \
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
72 wgaim_strerror( errno )
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
73 #define strerror( errornum ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
74 wgaim_strerror( errornum )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
75
4193
c297b9d4f67c [gaim-migrate @ 4424]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3776
diff changeset
76 extern char* wgaim_strsep(char **stringp, const char *delim);
c297b9d4f67c [gaim-migrate @ 4424]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3776
diff changeset
77 #define strsep( stringp, delim ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
78 wgaim_strsep( stringp, delim )
4193
c297b9d4f67c [gaim-migrate @ 4424]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3776
diff changeset
79
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
80 #define bzero( dest, size ) memset( dest, 0, size )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
81
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
82 /* unistd.h */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
83 extern int wgaim_read(int fd, void *buf, unsigned int size);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
84 #define read( fd, buf, buflen ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
85 wgaim_read( fd, buf, buflen )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
86
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
87 extern int wgaim_write(int fd, const void *buf, unsigned int size);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
88 #define write( socket, buf, buflen ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
89 wgaim_write( socket, buf, buflen )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
90
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
91 extern int wgaim_close(int fd);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
92 #define close( fd ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
93 wgaim_close( fd )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
94
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
95 #define sleep(x) Sleep((x)*1000)
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
96
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
97 /* sys/time.h */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
98 extern int wgaim_gettimeofday(struct timeval *p, struct timezone *z);
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
99 #define gettimeofday( timeval, timezone ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
100 wgaim_gettimeofday( timeval, timezone )
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
101
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
102 /* stdio.h */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
103 #define snprintf _snprintf
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
104 #define vsnprintf _vsnprintf
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
105
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4714
diff changeset
106 extern int wgaim_rename(const char *oldname, const char *newname);
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4714
diff changeset
107 #define rename( oldname, newname ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
108 wgaim_rename( oldname, newname )
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4714
diff changeset
109
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
110 /* sys/stat.h */
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
111 #define mkdir(a,b) _mkdir((a))
4373
dcc6c130c6d9 [gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
112 #define fchmod(a,b)
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
113
5113
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
114 /* time.h */
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
115 extern struct tm *wgaim_localtime_r(const time_t *time, struct tm *resultp);
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
116 #define localtime_r( time, resultp ) \
7242
59ffe137176d [gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
117 wgaim_localtime_r( time, resultp )
5113
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
118
3776
21d296405cfd [gaim-migrate @ 3916]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
119 #endif /* _LIBC_INTERFACE_H_ */